From ce8882242590c9768c3afb31d032d33eeca5ade9 Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Wed, 8 Jun 2022 22:09:42 +0530 Subject: [PATCH 01/38] feat: allow running workflows using cli command --- packages/cli/lang/en.json | 81 ++--- packages/cli/lang/es.json | 82 ++--- packages/cli/src/__tests__/e2e/query.spec.ts | 295 ------------------ packages/cli/src/__tests__/e2e/run.spec.ts | 218 +++++++++++++ packages/cli/src/__tests__/e2e/utils.ts | 23 +- packages/cli/src/commands/index.ts | 2 +- packages/cli/src/commands/query.ts | 188 ----------- packages/cli/src/commands/run.ts | 109 +++++++ .../src/lib/helpers/validate-client-config.ts | 46 +-- packages/cli/src/lib/parsers/index.ts | 2 +- .../cli/src/lib/parsers/{query.ts => run.ts} | 12 +- .../cli/api/query/recipes/constants.json | 3 - .../cli/api/query/recipes/constants.yaml | 1 - .../cases/cli/api/query/recipes/e2e.json | 14 - .../cases/cli/api/query/recipes/e2e.yaml | 7 - .../cases/cli/api/query/recipes/get.graphql | 8 - .../cases/cli/api/query/recipes/set.graphql | 14 - .../cases/cli/api/{query => run}/.gitignore | 0 .../api/{query => run}/client-async-config.js | 0 .../api/{query => run}/client-async-config.ts | 0 .../cli/api/{query => run}/client-config.js | 0 .../cli/api/{query => run}/client-config.ts | 0 .../api/{query => run}/deploy-contracts.js | 0 .../cases/cli/api/{query => run}/package.json | 0 .../src/contracts/SimpleStorage.json | 0 .../src/contracts/SimpleStorage.sol | 0 .../api/{query => run}/src/mutation/index.ts | 0 .../src/mutation/schema.graphql | 0 .../cli/api/{query => run}/src/query/index.ts | 0 .../{query => run}/src/query/schema.graphql | 0 .../web3api-deploy-fail-between.yaml | 0 .../web3api-deploy-invalid-config.yaml | 0 .../{query => run}/web3api-deploy-no-ext.yaml | 0 .../cli/api/{query => run}/web3api.build.yaml | 0 .../web3api.deploy.fail-between.yaml | 0 .../web3api.deploy.invalid-config.yaml | 0 .../{query => run}/web3api.deploy.no-ext.yaml | 0 .../api/{query => run}/web3api.deploy.yaml | 0 .../cases/cli/api/{query => run}/web3api.yaml | 0 .../cases/cli/api/run/workflows/config.ts | 82 +++++ .../cases/cli/api/run/workflows/e2e.json | 39 +++ .../cases/cli/api/run/workflows/e2e.yaml | 26 ++ 42 files changed, 605 insertions(+), 647 deletions(-) delete mode 100644 packages/cli/src/__tests__/e2e/query.spec.ts create mode 100644 packages/cli/src/__tests__/e2e/run.spec.ts delete mode 100644 packages/cli/src/commands/query.ts create mode 100644 packages/cli/src/commands/run.ts rename packages/cli/src/lib/parsers/{query.ts => run.ts} (87%) delete mode 100644 packages/test-cases/cases/cli/api/query/recipes/constants.json delete mode 100644 packages/test-cases/cases/cli/api/query/recipes/constants.yaml delete mode 100644 packages/test-cases/cases/cli/api/query/recipes/e2e.json delete mode 100644 packages/test-cases/cases/cli/api/query/recipes/e2e.yaml delete mode 100644 packages/test-cases/cases/cli/api/query/recipes/get.graphql delete mode 100644 packages/test-cases/cases/cli/api/query/recipes/set.graphql rename packages/test-cases/cases/cli/api/{query => run}/.gitignore (100%) rename packages/test-cases/cases/cli/api/{query => run}/client-async-config.js (100%) rename packages/test-cases/cases/cli/api/{query => run}/client-async-config.ts (100%) rename packages/test-cases/cases/cli/api/{query => run}/client-config.js (100%) rename packages/test-cases/cases/cli/api/{query => run}/client-config.ts (100%) rename packages/test-cases/cases/cli/api/{query => run}/deploy-contracts.js (100%) rename packages/test-cases/cases/cli/api/{query => run}/package.json (100%) rename packages/test-cases/cases/cli/api/{query => run}/src/contracts/SimpleStorage.json (100%) rename packages/test-cases/cases/cli/api/{query => run}/src/contracts/SimpleStorage.sol (100%) rename packages/test-cases/cases/cli/api/{query => run}/src/mutation/index.ts (100%) rename packages/test-cases/cases/cli/api/{query => run}/src/mutation/schema.graphql (100%) rename packages/test-cases/cases/cli/api/{query => run}/src/query/index.ts (100%) rename packages/test-cases/cases/cli/api/{query => run}/src/query/schema.graphql (100%) rename packages/test-cases/cases/cli/api/{query => run}/web3api-deploy-fail-between.yaml (100%) rename packages/test-cases/cases/cli/api/{query => run}/web3api-deploy-invalid-config.yaml (100%) rename packages/test-cases/cases/cli/api/{query => run}/web3api-deploy-no-ext.yaml (100%) rename packages/test-cases/cases/cli/api/{query => run}/web3api.build.yaml (100%) rename packages/test-cases/cases/cli/api/{query => run}/web3api.deploy.fail-between.yaml (100%) rename packages/test-cases/cases/cli/api/{query => run}/web3api.deploy.invalid-config.yaml (100%) rename packages/test-cases/cases/cli/api/{query => run}/web3api.deploy.no-ext.yaml (100%) rename packages/test-cases/cases/cli/api/{query => run}/web3api.deploy.yaml (100%) rename packages/test-cases/cases/cli/api/{query => run}/web3api.yaml (100%) create mode 100644 packages/test-cases/cases/cli/api/run/workflows/config.ts create mode 100644 packages/test-cases/cases/cli/api/run/workflows/e2e.json create mode 100644 packages/test-cases/cases/cli/api/run/workflows/e2e.yaml diff --git a/packages/cli/lang/en.json b/packages/cli/lang/en.json index 80af283a31..6f1cba13c4 100644 --- a/packages/cli/lang/en.json +++ b/packages/cli/lang/en.json @@ -64,7 +64,6 @@ "commands_create_options_o": "Output directory for the new project", "commands_create_options_o_path": "path", "commands_create_options_projectName": "project-name", - "commands_query_options_recipeScript": "Path to recipe script", "commands_create_overwritePrompt": "Do you want to overwrite this directory?", "commands_create_overwriting": "Overwriting {dir}...", "commands_create_readyApp": "You are ready to build an app using Web3API", @@ -102,45 +101,47 @@ "commands_plugin_options_path": "path", "commands_plugin_options_publish": "Output path for the built schema and manifest (default: {default})", "commands_plugin_options_codegen": "Output directory for the generated types (default: {default})", - "commands_query_options_configPath": "config-path", - "commands_query_options_outputFilePath": "output-file-path", - "commands_query_options_config": "Add custom configuration to the Web3ApiClient", - "commands_query_options_outputFile": "Output file path for the query result", - "commands_query_options_quiet": "Suppress output", - "commands_query_error_outputFileMissing": "{option} option missing {argument} argument", - "commands_query_error_clientConfigMissingPath": "{option} option missing {argument} argument", - "commands_query_error_clientConfigModuleMissingExport": "Custom client config module missing named export 'getClientConfig' at {module}", - "commands_query_error_clientConfigInvalidFileExt": "Custom client config file: {module} must be a JS/TS file", - "commands_query_error_clientConfigNotObject": "Custom client config must be an object", - "commands_query_error_redirectsExportNotArray": "Exported redirects must be an array", - "commands_query_error_redirectsItemNotValid": "Redirect at index {index} must be an object with properties 'from' and 'to'", - "commands_query_error_redirectsItemFromNotString": "Redirect property 'from' at index {index} must be a valid w3:// URI string", - "commands_query_error_redirectsItemToNotStringOrObject": "Redirect property 'to' at index {index} must be a valid w3:// URI string, or a plugin", - "commands_query_error_redirectsItemToNotValidPlugin": "Redirect property 'to' at index {index} must be a valid plugin instance", - "commands_query_error_pluginsExportNotArray": "Exported plugins must be an array", - "commands_query_error_pluginsItemNotObject": "Plugin at index {index} must be an object with properties 'uri' and 'plugin'", - "commands_query_error_pluginsItemUriNotString": "Plugin property 'uri' at index {index} must be a valid w3:// URI string", - "commands_query_error_pluginsItemPluginNotObject": "Plugin property 'plugin' at index {index} must be an object with properties 'factory' and 'manifest'", - "commands_query_error_pluginsItemPluginFactoryNotFunction": "Plugin property 'plugin.factory' at index {index} must be a function", - "commands_query_error_pluginsItemPluginManifestNotObject": "Plugin property 'plugin.manifest' at index {index} must be an object", - "commands_query_error_interfacesExportNotArray": "Exported interfaces must be an array", - "commands_query_error_interfacesItemNotObject": "Interface at index {index} must be an object with properties 'interface' and 'implementations'", - "commands_query_error_interfacesItemInterfaceNotString": "Interface property 'interface' at index {index} must be a valid w3:// URI string", - "commands_query_error_interfacesItemImplementationsNotArray": "Interface property 'implementations' at index {index} must be an array", - "commands_query_error_interfacesItemImplementationsEmpty": "Interface property 'implementations' at index {index} must not be an empty array", - "commands_query_error_interfacesItemImplementationsItemNotString": "Implementation at index ({index}, {implementationIndex}) must be a valid w3:// URI string", - "commands_query_error_envsExportNotArray": "Exported envs must be an array", - "commands_query_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri' and optional properties 'common', 'query', and 'mutation'", - "commands_query_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid w3:// URI string", - "commands_query_error_envsItemCommonNotObject": "Env property 'common' at index {index} must be an object", - "commands_query_error_envsItemQueryNotObject": "Env property 'query' at index {index} must be an object", - "commands_query_error_envsItemMutationNotObject": "Env property 'mutation' at index {index} must be an object", - "commands_query_description": "Query Web3APIs using recipe scripts", - "commands_query_error_missingScript": "Required argument {script} is missing", - "commands_query_error_noApi": "API needs to be initialized", - "commands_query_error_readFail": "Failed to read query {query}", - "commands_query_error_noRecipeScriptFound": "Recipe script not found at path: {path}", - "commands_query_error_noTestEnvFound": "w3 test-env not found, please run 'w3 test-env up'", + "commands_run_options_workflowScript": "Path to workflow script", + "commands_run_options_configPath": "config-path", + "commands_run_options_outputFilePath": "output-file-path", + "commands_run_options_config": "Add custom configuration to the Web3ApiClient", + "commands_run_options_outputFile": "Output file path for the workflow result", + "commands_run_options_quiet": "Suppress output", + "commands_run_options_jobs": "Specify ids of jobs that you want to run", + "commands_run_error_outputFileMissing": "{option} option missing {argument} argument", + "commands_run_error_clientConfigMissingPath": "{option} option missing {argument} argument", + "commands_run_error_clientConfigModuleMissingExport": "Custom client config module missing named export 'getClientConfig' at {module}", + "commands_run_error_clientConfigInvalidFileExt": "Custom client config file: {module} must be a JS/TS file", + "commands_run_error_clientConfigNotObject": "Custom client config must be an object", + "commands_run_error_redirectsExportNotArray": "Exported redirects must be an array", + "commands_run_error_redirectsItemNotValid": "Redirect at index {index} must be an object with properties 'from' and 'to'", + "commands_run_error_redirectsItemFromNotString": "Redirect property 'from' at index {index} must be a valid w3:// URI string", + "commands_run_error_redirectsItemToNotStringOrObject": "Redirect property 'to' at index {index} must be a valid w3:// URI string, or a plugin", + "commands_run_error_redirectsItemToNotValidPlugin": "Redirect property 'to' at index {index} must be a valid plugin instance", + "commands_run_error_pluginsExportNotArray": "Exported plugins must be an array", + "commands_run_error_pluginsItemNotObject": "Plugin at index {index} must be an object with properties 'uri' and 'plugin'", + "commands_run_error_pluginsItemUriNotString": "Plugin property 'uri' at index {index} must be a valid w3:// URI string", + "commands_run_error_pluginsItemPluginNotObject": "Plugin property 'plugin' at index {index} must be an object with properties 'factory' and 'manifest'", + "commands_run_error_pluginsItemPluginFactoryNotFunction": "Plugin property 'plugin.factory' at index {index} must be a function", + "commands_run_error_pluginsItemPluginManifestNotObject": "Plugin property 'plugin.manifest' at index {index} must be an object", + "commands_run_error_interfacesExportNotArray": "Exported interfaces must be an array", + "commands_run_error_interfacesItemNotObject": "Interface at index {index} must be an object with properties 'interface' and 'implementations'", + "commands_run_error_interfacesItemInterfaceNotString": "Interface property 'interface' at index {index} must be a valid w3:// URI string", + "commands_run_error_interfacesItemImplementationsNotArray": "Interface property 'implementations' at index {index} must be an array", + "commands_run_error_interfacesItemImplementationsEmpty": "Interface property 'implementations' at index {index} must not be an empty array", + "commands_run_error_interfacesItemImplementationsItemNotString": "Implementation at index ({index}, {implementationIndex}) must be a valid w3:// URI string", + "commands_run_error_envsExportNotArray": "Exported envs must be an array", + "commands_run_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri' and optional properties 'common', 'query', and 'mutation'", + "commands_run_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid w3:// URI string", + "commands_run_error_envsItemCommonNotObject": "Env property 'common' at index {index} must be an object", + "commands_run_error_envsItemQueryNotObject": "Env property 'query' at index {index} must be an object", + "commands_run_error_envsItemMutationNotObject": "Env property 'mutation' at index {index} must be an object", + "commands_run_description": "Runs workflow script", + "commands_run_error_missingScript": "Required argument {script} is missing", + "commands_run_error_noApi": "API needs to be initialized", + "commands_run_error_readFail": "Failed to read query {query}", + "commands_run_error_noWorkflowScriptFound": "Workflow script not found at path: {path}", + "commands_run_error_noTestEnvFound": "w3 test-env not found, please run 'w3 test-env up'", "commands_testEnv_description": "Manage a test environment for Web3API", "commands_testEnv_error_never": "This should never happen...", "commands_testEnv_error_noCommand": "No command given", diff --git a/packages/cli/lang/es.json b/packages/cli/lang/es.json index 399224614d..60438e8627 100644 --- a/packages/cli/lang/es.json +++ b/packages/cli/lang/es.json @@ -1,4 +1,3 @@ - { "commands_build_description": "Builds a Web3API", "commands_build_error_manifestPathMissing": "{option} option missing {argument} argument", @@ -65,7 +64,6 @@ "commands_create_options_o": "Output directory for the new project", "commands_create_options_o_path": "path", "commands_create_options_projectName": "project-name", - "commands_query_options_recipeScript": "Path to recipe script", "commands_create_overwritePrompt": "Do you want to overwrite this directory?", "commands_create_overwriting": "Overwriting {dir}...", "commands_create_readyApp": "You are ready to build an app using Web3API", @@ -103,45 +101,47 @@ "commands_plugin_options_path": "path", "commands_plugin_options_publish": "Output path for the built schema and manifest (default: {default})", "commands_plugin_options_codegen": "Output directory for the generated types (default: {default})", - "commands_query_options_configPath": "config-path", - "commands_query_options_outputFilePath": "output-file-path", - "commands_query_options_config": "Add custom configuration to the Web3ApiClient", - "commands_query_options_outputFile": "Output file path for the query result", - "commands_query_options_quiet": "Suppress output", - "commands_query_error_outputFileMissing": "{option} option missing {argument} argument", - "commands_query_error_clientConfigMissingPath": "{option} option missing {argument} argument", - "commands_query_error_clientConfigModuleMissingExport": "Custom client config module missing named export 'getClientConfig' at {module}", - "commands_query_error_clientConfigInvalidFileExt": "Custom client config file: {module} must be a JS/TS file", - "commands_query_error_clientConfigNotObject": "Custom client config must be an object", - "commands_query_error_redirectsExportNotArray": "Exported redirects must be an array", - "commands_query_error_redirectsItemNotValid": "Redirect at index {index} must be an object with properties 'from' and 'to'", - "commands_query_error_redirectsItemFromNotString": "Redirect property 'from' at index {index} must be a valid w3:// URI string", - "commands_query_error_redirectsItemToNotStringOrObject": "Redirect property 'to' at index {index} must be a valid w3:// URI string, or a plugin", - "commands_query_error_redirectsItemToNotValidPlugin": "Redirect property 'to' at index {index} must be a valid plugin instance", - "commands_query_error_pluginsExportNotArray": "Exported plugins must be an array", - "commands_query_error_pluginsItemNotObject": "Plugin at index {index} must be an object with properties 'uri' and 'plugin'", - "commands_query_error_pluginsItemUriNotString": "Plugin property 'uri' at index {index} must be a valid w3:// URI string", - "commands_query_error_pluginsItemPluginNotObject": "Plugin property 'plugin' at index {index} must be an object with properties 'factory' and 'manifest'", - "commands_query_error_pluginsItemPluginFactoryNotFunction": "Plugin property 'plugin.factory' at index {index} must be a function", - "commands_query_error_pluginsItemPluginManifestNotObject": "Plugin property 'plugin.manifest' at index {index} must be an object", - "commands_query_error_interfacesExportNotArray": "Exported interfaces must be an array", - "commands_query_error_interfacesItemNotObject": "Interface at index {index} must be an object with properties 'interface' and 'implementations'", - "commands_query_error_interfacesItemInterfaceNotString": "Interface property 'interface' at index {index} must be a valid w3:// URI string", - "commands_query_error_interfacesItemImplementationsNotArray": "Interface property 'implementations' at index {index} must be an array", - "commands_query_error_interfacesItemImplementationsEmpty": "Interface property 'implementations' at index {index} must not be an empty array", - "commands_query_error_interfacesItemImplementationsItemNotString": "Implementation at index ({index}, {implementationIndex}) must be a valid w3:// URI string", - "commands_query_error_envsExportNotArray": "Exported envs must be an array", - "commands_query_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri' and optional properties 'common', 'query', and 'mutation'", - "commands_query_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid w3:// URI string", - "commands_query_error_envsItemCommonNotObject": "Env property 'common' at index {index} must be an object", - "commands_query_error_envsItemQueryNotObject": "Env property 'query' at index {index} must be an object", - "commands_query_error_envsItemMutationNotObject": "Env property 'mutation' at index {index} must be an object", - "commands_query_description": "Query Web3APIs using recipe scripts", - "commands_query_error_missingScript": "Required argument {script} is missing", - "commands_query_error_noApi": "API needs to be initialized", - "commands_query_error_readFail": "Failed to read query {query}", - "commands_query_error_noRecipeScriptFound": "Recipe script not found at path: {path}", - "commands_query_error_noTestEnvFound": "w3 test-env not found, please run 'w3 test-env up'", + "commands_run_options_workflowScript": "Path to workflow script", + "commands_run_options_configPath": "config-path", + "commands_run_options_outputFilePath": "output-file-path", + "commands_run_options_config": "Add custom configuration to the Web3ApiClient", + "commands_run_options_outputFile": "Output file path for the query result", + "commands_run_options_quiet": "Suppress output", + "commands_run_options_jobs": "Specify ids of jobs that you want to run", + "commands_run_error_outputFileMissing": "{option} option missing {argument} argument", + "commands_run_error_clientConfigMissingPath": "{option} option missing {argument} argument", + "commands_run_error_clientConfigModuleMissingExport": "Custom client config module missing named export 'getClientConfig' at {module}", + "commands_run_error_clientConfigInvalidFileExt": "Custom client config file: {module} must be a JS/TS file", + "commands_run_error_clientConfigNotObject": "Custom client config must be an object", + "commands_run_error_redirectsExportNotArray": "Exported redirects must be an array", + "commands_run_error_redirectsItemNotValid": "Redirect at index {index} must be an object with properties 'from' and 'to'", + "commands_run_error_redirectsItemFromNotString": "Redirect property 'from' at index {index} must be a valid w3:// URI string", + "commands_run_error_redirectsItemToNotStringOrObject": "Redirect property 'to' at index {index} must be a valid w3:// URI string, or a plugin", + "commands_run_error_redirectsItemToNotValidPlugin": "Redirect property 'to' at index {index} must be a valid plugin instance", + "commands_run_error_pluginsExportNotArray": "Exported plugins must be an array", + "commands_run_error_pluginsItemNotObject": "Plugin at index {index} must be an object with properties 'uri' and 'plugin'", + "commands_run_error_pluginsItemUriNotString": "Plugin property 'uri' at index {index} must be a valid w3:// URI string", + "commands_run_error_pluginsItemPluginNotObject": "Plugin property 'plugin' at index {index} must be an object with properties 'factory' and 'manifest'", + "commands_run_error_pluginsItemPluginFactoryNotFunction": "Plugin property 'plugin.factory' at index {index} must be a function", + "commands_run_error_pluginsItemPluginManifestNotObject": "Plugin property 'plugin.manifest' at index {index} must be an object", + "commands_run_error_interfacesExportNotArray": "Exported interfaces must be an array", + "commands_run_error_interfacesItemNotObject": "Interface at index {index} must be an object with properties 'interface' and 'implementations'", + "commands_run_error_interfacesItemInterfaceNotString": "Interface property 'interface' at index {index} must be a valid w3:// URI string", + "commands_run_error_interfacesItemImplementationsNotArray": "Interface property 'implementations' at index {index} must be an array", + "commands_run_error_interfacesItemImplementationsEmpty": "Interface property 'implementations' at index {index} must not be an empty array", + "commands_run_error_interfacesItemImplementationsItemNotString": "Implementation at index ({index}, {implementationIndex}) must be a valid w3:// URI string", + "commands_run_error_envsExportNotArray": "Exported envs must be an array", + "commands_run_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri' and optional properties 'common', 'query', and 'mutation'", + "commands_run_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid w3:// URI string", + "commands_run_error_envsItemCommonNotObject": "Env property 'common' at index {index} must be an object", + "commands_run_error_envsItemQueryNotObject": "Env property 'query' at index {index} must be an object", + "commands_run_error_envsItemMutationNotObject": "Env property 'mutation' at index {index} must be an object", + "commands_run_description": "Runs workflow script", + "commands_run_error_missingScript": "Required argument {script} is missing", + "commands_run_error_noApi": "API needs to be initialized", + "commands_run_error_readFail": "Failed to read query {query}", + "commands_run_error_noWorkflowScriptFound": "Workflow script not found at path: {path}", + "commands_run_error_noTestEnvFound": "w3 test-env not found, please run 'w3 test-env up'", "commands_testEnv_description": "Manage a test environment for Web3API", "commands_testEnv_error_never": "This should never happen...", "commands_testEnv_error_noCommand": "No command given", diff --git a/packages/cli/src/__tests__/e2e/query.spec.ts b/packages/cli/src/__tests__/e2e/query.spec.ts deleted file mode 100644 index d7efec3074..0000000000 --- a/packages/cli/src/__tests__/e2e/query.spec.ts +++ /dev/null @@ -1,295 +0,0 @@ -import fs from "fs"; -import path from "path"; -import yaml from "js-yaml"; - -import { clearStyle, w3Cli } from "./utils"; - -import { - buildAndDeployApi, - initTestEnvironment, - runCLI, -} from "@web3api/test-env-js"; -import { GetPathToCliTestFiles } from "@web3api/test-cases"; -import { normalizeLineEndings } from "@web3api/os-js"; -import { - checkSampleQueryOutput, - getSampleObjectOutput, - getSampleOutputWithClientConfig, - ISampleOutputOptions, -} from "./query.spec.helper"; - -jest.setTimeout(200000); - -const HELP = `Usage: w3 query|q [options] - -Query Web3APIs using recipe scripts - -Arguments: - recipe Path to recipe script - -Options: - -c, --client-config Add custom configuration to the - Web3ApiClient - -o, --output-file Output file path for the query result - -q, --quiet Suppress output - -h, --help display help for command -`; - -describe("sanity tests for query command", () => { - const testCaseRoot = path.join(GetPathToCliTestFiles(), "api/query"); - - test("Should show help text", async () => { - const { exitCode: code, stdout: output, stderr: error } = await runCLI({ - args: ["query", "--help"], - cwd: testCaseRoot, - }); - - expect(code).toEqual(0); - expect(error).toBe(""); - expect(clearStyle(output)).toEqual(HELP); - }); - - test("Should throw error for missing recipe-string", async () => { - const { exitCode, stdout, stderr } = await runCLI({ - args: ["query"], - cwd: testCaseRoot, - cli: w3Cli, - }); - - expect(exitCode).toEqual(1); - expect(stderr).toContain("error: missing required argument 'recipe"); - expect(stdout).toEqual(``); - }); - - test("Should throw error is --client-config doesn't contain arguments", async () => { - const { exitCode, stdout, stderr } = await runCLI({ - args: ["query", "./recipes/e2e.json", "--client-config"], - cwd: testCaseRoot, - cli: w3Cli, - }); - - expect(exitCode).toEqual(1); - expect(stderr).toBe( - "error: option '-c, --client-config ' argument missing\n" - ); - expect(stdout).toEqual(``); - }); -}); - -describe("e2e tests for query command", () => { - const testCaseRoot = path.join(GetPathToCliTestFiles(), "api/query"); - - beforeAll(async () => { - const { - ipfs, - ethereum, - ensAddress: ens, - registrarAddress, - resolverAddress, - } = await initTestEnvironment(); - - const { stderr: deployErr } = await runCLI({ - args: ["./deploy-contracts.js"], - cwd: testCaseRoot, - cli: " ", - }); - - expect(deployErr).toBe(""); - - await buildAndDeployApi({ - apiAbsPath: testCaseRoot, - ipfsProvider: ipfs, - ethereumProvider: ethereum, - ensRegistrarAddress: registrarAddress, - ensResolverAddress: resolverAddress, - ensRegistryAddress: ens, - ensName: "simplestorage.eth", - }) - }); - - afterAll(async () => { - await runCLI({ - args: ["test-env", "down"], - cwd: testCaseRoot, - cli: w3Cli, - }); - }); - - test("Should successfully return response: using json recipes", async () => { - const { exitCode: code, stdout: output, stderr: queryErr } = await runCLI({ - args: ["query", "./recipes/e2e.json"], - cwd: testCaseRoot, - cli: w3Cli, - }); - - expect(code).toEqual(0); - expect(queryErr).toBe(""); - - const constants = require(`${testCaseRoot}/recipes/constants.json`); - checkSampleQueryOutput(output, { - SimpleStorageAddr: constants.SimpleStorageAddr, - }); - }, 480000); - - test("Should successfully return response: using yaml recipes", async () => { - const { exitCode: code, stdout: output, stderr: queryErr } = await runCLI({ - args: ["query", "./recipes/e2e.yaml"], - cwd: testCaseRoot, - cli: w3Cli, - }); - - expect(code).toEqual(0); - expect(queryErr).toBe(""); - - const constants = yaml.load( - await fs.promises.readFile( - `${testCaseRoot}/recipes/constants.yaml`, - "utf8" - ) - ) as ISampleOutputOptions; - - checkSampleQueryOutput(output, { - SimpleStorageAddr: constants.SimpleStorageAddr, - }); - }, 480000); - - test("Should successfully return response: using mix of yaml & json recipes", async () => { - const { exitCode: code, stdout: output, stderr: queryErr } = await runCLI({ - args: ["query", "./recipes/e2e.json"], - cwd: testCaseRoot, - cli: w3Cli, - }); - - expect(code).toEqual(0); - expect(queryErr).toBe(""); - - const constants = yaml.load( - await fs.promises.readFile( - `${testCaseRoot}/recipes/constants.yaml`, - "utf8" - ) - ) as ISampleOutputOptions; - - checkSampleQueryOutput(output, { - SimpleStorageAddr: constants.SimpleStorageAddr, - }); - }, 480000); - - test("Should successfully create json output file if specified", async () => { - const { exitCode: code, stdout: output, stderr: queryErr } = await runCLI({ - args: [ - "query", - "./recipes/e2e.json", - "--output-file", - "./recipes/output.json", - ], - cwd: testCaseRoot, - cli: w3Cli, - }); - - expect(code).toEqual(0); - expect(queryErr).toBe(""); - - const constants = require(`${testCaseRoot}/recipes/constants.json`); - checkSampleQueryOutput(output, { - SimpleStorageAddr: constants.SimpleStorageAddr, - }); - - expect(fs.existsSync(`${testCaseRoot}/recipes/output.json`)).toBeTruthy(); - const arr: Array = JSON.parse( - fs.readFileSync(`${testCaseRoot}/recipes/output.json`, "utf8") - ); - expect(Array.isArray(arr)).toBeTruthy(); - - expect(arr[2]).toMatchObject(getSampleObjectOutput()); - - fs.unlinkSync(`${testCaseRoot}/recipes/output.json`); - }, 48000); - - test("Should successfully create yaml output file if specified", async () => { - const { exitCode: code, stdout: output, stderr: queryErr } = await runCLI({ - args: [ - "query", - "./recipes/e2e.yaml", - "--output-file", - "./recipes/output.yaml", - ], - cwd: testCaseRoot, - cli: w3Cli, - }); - - expect(code).toEqual(0); - expect(queryErr).toBe(""); - - const constants = yaml.load( - await fs.promises.readFile( - `${testCaseRoot}/recipes/constants.yaml`, - "utf8" - ) - ) as ISampleOutputOptions; - - checkSampleQueryOutput(output, { - SimpleStorageAddr: constants.SimpleStorageAddr, - }); - - expect(fs.existsSync(`${testCaseRoot}/recipes/output.yaml`)).toBeTruthy(); - const arr: Array = (yaml.load( - fs.readFileSync(`${testCaseRoot}/recipes/output.yaml`, "utf8") - ) as unknown) as Array; - expect(Array.isArray(arr)).toBeTruthy(); - expect(arr[2]).toMatchObject(getSampleObjectOutput()); - - fs.unlinkSync(`${testCaseRoot}/recipes/output.yaml`); - }, 48000); - - test("Should suppress the ouput if --quiet option is specified", async () => { - const { exitCode: code, stdout: output, stderr: queryErr } = await runCLI({ - args: [ - "query", - "./recipes/e2e.json", - "--quiet", - ], - cwd: testCaseRoot, - cli: w3Cli, - }); - - expect(code).toEqual(0); - expect(queryErr).toBe(""); - expect(output).toBeFalsy(); - }, 48000); - - test("Should use custom config for client if specified", async () => { - const configs = [ - "./client-config.ts", - "./client-config.js", - "./client-async-config.ts", - "./client-async-config.js", - ]; - - for (const config of configs) { - const { exitCode, stdout, stderr } = await runCLI({ - args: [ - "query", - "./recipes/e2e.json", - "--client-config", - config, - ], - cwd: testCaseRoot, - cli: w3Cli, - }); - - expect(stderr).toBeFalsy(); - expect(stdout).toBeTruthy(); - - expect(exitCode).toEqual(0); - expect(stderr).toBe(""); - - const constants = require(`${testCaseRoot}/recipes/constants.json`); - expect(clearStyle(normalizeLineEndings(stdout, "\n"))).toContain( - getSampleOutputWithClientConfig({ - SimpleStorageAddr: constants.SimpleStorageAddr, - }) - ); - } - }, 48000); -}); diff --git a/packages/cli/src/__tests__/e2e/run.spec.ts b/packages/cli/src/__tests__/e2e/run.spec.ts new file mode 100644 index 0000000000..3d880b74e6 --- /dev/null +++ b/packages/cli/src/__tests__/e2e/run.spec.ts @@ -0,0 +1,218 @@ +import fs from "fs"; +import path from "path"; +import yaml from "js-yaml"; + +import { parseOutput, w3Cli } from "./utils"; + +import { + buildAndDeployApi, + initTestEnvironment, + runCLI, +} from "@web3api/test-env-js"; +import { GetPathToCliTestFiles } from "@web3api/test-cases"; + +jest.setTimeout(200000); + +const HELP = `Usage: w3 run|r [options] + +Runs workflow script + +Arguments: + workflow Path to workflow script + +Options: + -c, --client-config Add custom configuration to the + Web3ApiClient + -o, --output-file Output file path for the workflow + result + -j, --jobs Specify ids of jobs that you want to + run + -q, --quiet Suppress output + -h, --help display help for command +`; + +describe("sanity tests for workflow command", () => { + const testCaseRoot = path.join(GetPathToCliTestFiles(), "api/run"); + + test("Should show help text", async () => { + const { exitCode: code, stdout: output, stderr: error } = await runCLI({ + args: ["run", "--help"], + cwd: testCaseRoot, + }); + + expect(code).toEqual(0); + expect(error).toBe(""); + expect(output).toEqual(HELP); + }); + + test("Should throw error for missing workflow-string", async () => { + const { exitCode, stdout, stderr } = await runCLI({ + args: ["run"], + cwd: testCaseRoot, + cli: w3Cli, + }); + + expect(exitCode).toEqual(1); + expect(stderr).toContain("error: missing required argument 'workflow'"); + expect(stdout).toEqual(``); + }); + + test("Should throw error is --client-config doesn't contain arguments", async () => { + const { exitCode, stdout, stderr } = await runCLI({ + args: ["run", "./recipes/e2e.json", "--client-config"], + cwd: testCaseRoot, + cli: w3Cli, + }); + + expect(exitCode).toEqual(1); + expect(stderr).toBe( + "error: option '-c, --client-config ' argument missing\n" + ); + expect(stdout).toEqual(``); + }); +}); + +describe("e2e tests for run command", () => { + const testCaseRoot = path.join(GetPathToCliTestFiles(), "api/run"); + + beforeAll(async () => { + const { + ipfs, + ethereum, + ensAddress: ens, + registrarAddress, + resolverAddress, + } = await initTestEnvironment(); + + await buildAndDeployApi({ + apiAbsPath: testCaseRoot, + ipfsProvider: ipfs, + ethereumProvider: ethereum, + ensRegistrarAddress: registrarAddress, + ensResolverAddress: resolverAddress, + ensRegistryAddress: ens, + ensName: "simple-storage.eth", + }); + }); + + afterAll(async () => { + await runCLI({ + args: ["test-env", "down"], + cwd: testCaseRoot, + cli: w3Cli, + }); + }); + + test("Should successfully return response: using json workflow", async () => { + const { exitCode: code, stdout, stderr } = await runCLI({ + args: ["run", "./workflows/e2e.json", "-c", "./workflows/config.ts"], + cwd: testCaseRoot, + cli: w3Cli, + }); + expect(code).toEqual(0); + expect(stderr).toBe(""); + + const output = parseOutput(stdout); + output.forEach((item) => { + expect(item.error).toBeUndefined(); + expect(item.data).toBeDefined(); + }); + expect(output).toHaveLength(3); + }, 480000); + + test("Should successfully return response: using yaml workflow", async () => { + const { exitCode: code, stdout, stderr } = await runCLI({ + args: ["run", "./workflows/e2e.yaml", "-c", "./workflows/config.ts"], + cwd: testCaseRoot, + cli: w3Cli, + }); + + expect(code).toEqual(0); + expect(stderr).toBe(""); + + const output = parseOutput(stdout); + output.forEach((item) => { + expect(item.error).toBeUndefined(); + expect(item.data).toBeDefined(); + }); + expect(output).toHaveLength(3); + }, 480000); + + test("Should successfully create json output file if specified", async () => { + const { exitCode: code, stdout, stderr } = await runCLI({ + args: [ + "run", + "./workflows/e2e.json", + "-c", + "./workflows/config.ts", + "--output-file", + "./workflows/output.json", + ], + cwd: testCaseRoot, + cli: w3Cli, + }); + + expect(code).toEqual(0); + expect(stderr).toBe(""); + expect(parseOutput(stdout)).toMatchObject( + JSON.parse( + fs.readFileSync( + path.join(testCaseRoot, "workflows/output.json"), + "utf8" + ) + ) + ); + + fs.unlinkSync(`${testCaseRoot}/workflows/output.json`); + }, 48000); + + test("Should successfully create yaml output file if specified", async () => { + const { exitCode: code, stdout, stderr } = await runCLI({ + args: [ + "run", + "./workflows/e2e.json", + "-c", + "./workflows/config.ts", + "--output-file", + "./workflows/output.yaml", + ], + cwd: testCaseRoot, + cli: w3Cli, + }); + + expect(code).toEqual(0); + expect(stderr).toBe(""); + expect(parseOutput(stdout)).toMatchObject( + JSON.parse( + JSON.stringify( + (yaml.load( + fs.readFileSync( + path.join(testCaseRoot, "workflows/output.yaml"), + "utf8" + ) + ) as unknown) as Array + ) + ) + ); + + fs.unlinkSync(`${testCaseRoot}/workflows/output.yaml`); + }, 48000); + + test("Should suppress the ouput if --quiet option is specified", async () => { + const { exitCode: code, stdout, stderr } = await runCLI({ + args: [ + "run", + "./workflows/e2e.json", + "-c", + "./workflows/config.ts", + "--quiet", + ], + cwd: testCaseRoot, + cli: w3Cli, + }); + + expect(code).toEqual(0); + expect(stderr).toBe(""); + expect(stdout).toBeFalsy(); + }, 48000); +}); diff --git a/packages/cli/src/__tests__/e2e/utils.ts b/packages/cli/src/__tests__/e2e/utils.ts index f1ef76bee0..f3ea73b8ee 100644 --- a/packages/cli/src/__tests__/e2e/utils.ts +++ b/packages/cli/src/__tests__/e2e/utils.ts @@ -1,8 +1,21 @@ -export const clearStyle = (styled: string) => { - return styled.replace( - /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, - "" - ); +export const parseOutput = ( + outputs: string +): Array<{ id: string; data?: unknown, error?: unknown }> => { + const outputsArr = outputs.split(/-{35}[\t \n]+-{35}/); + return outputsArr.map((output) => { + output = output.replace(/-{35}/, ""); + const idIdx = output.indexOf("ID: "); + const dataIdx = output.indexOf("Data: "); + if (dataIdx !== -1) { + const id = output.substring(idIdx + 3, dataIdx - 1); + const data = output.substring(dataIdx + 6); + return { id: id.replace(/\s/g, ""), data: JSON.parse(data) }; + } else { + const errIdx = output.indexOf("Error: "); + const id = output.substring(idIdx + 3); + return { id: id.replace(/\s/g, ""), error: output.substring(errIdx + 7) }; + } + }); }; export const w3Cli = `${__dirname}/../../../bin/w3`; diff --git a/packages/cli/src/commands/index.ts b/packages/cli/src/commands/index.ts index 5c76003da2..139c8a275d 100644 --- a/packages/cli/src/commands/index.ts +++ b/packages/cli/src/commands/index.ts @@ -4,5 +4,5 @@ export * from "./codegen"; export * from "./create"; export * from "./deploy"; export * from "./plugin"; -export * from "./query"; +export * from "./run"; export * from "./test-env"; diff --git a/packages/cli/src/commands/query.ts b/packages/cli/src/commands/query.ts deleted file mode 100644 index dabd8175e3..0000000000 --- a/packages/cli/src/commands/query.ts +++ /dev/null @@ -1,188 +0,0 @@ -import { Command, Program } from "./types"; -import { intlMsg } from "../lib"; -import { - parseClientConfigOption, - parseRecipeOutputFilePathOption, -} from "../lib/parsers"; - -import { Web3ApiClient, Web3ApiClientConfig } from "@web3api/client-js"; -import gql from "graphql-tag"; -import path from "path"; -import yaml from "js-yaml"; -import fs from "fs"; - -type QueryCommandOptions = { - clientConfig: Partial; - outputFile?: string; - quiet?: boolean; -}; - -export const query: Command = { - setup: (program: Program) => { - program - .command("query") - .alias("q") - .description(intlMsg.commands_query_description()) - .argument("", intlMsg.commands_query_options_recipeScript()) - .option( - `-c, --client-config <${intlMsg.commands_query_options_configPath()}> `, - `${intlMsg.commands_query_options_config()}` - ) - .option( - `-o, --output-file <${intlMsg.commands_query_options_outputFilePath()}>`, - `${intlMsg.commands_query_options_outputFile()}` - ) - .option(`-q, --quiet`, `${intlMsg.commands_query_options_quiet()}`) - .action(async (recipe: string, options) => { - await run(recipe, { - ...options, - clientConfig: await parseClientConfigOption( - options.clientConfig, - undefined - ), - outputFile: options.outputFile - ? parseRecipeOutputFilePathOption(options.outputFile, undefined) - : undefined, - }); - }); - }, -}; - -async function run(recipePath: string, options: QueryCommandOptions) { - const { clientConfig, outputFile, quiet } = options; - const client = new Web3ApiClient(clientConfig); - - function getParser(path: string) { - return path.endsWith(".yaml") || path.endsWith(".yml") - ? yaml.load - : JSON.parse; - } - - const recipe = getParser(recipePath)(fs.readFileSync(recipePath).toString()); - const dir = path.dirname(recipePath); - let uri = ""; - const recipeOutput = []; - - let constants: Record = {}; - for (const task of recipe) { - if (task.api) { - uri = task.api; - recipeOutput.push({ api: task.api }); - } - - if (task.constants) { - constants = getParser(task.constants)( - fs.readFileSync(path.join(dir, task.constants)).toString() - ); - recipeOutput.push({ constants: task.constants }); - } - - if (task.query) { - const query = fs.readFileSync(path.join(dir, task.query)).toString(); - - if (!query) { - const readFailMessage = intlMsg.commands_query_error_readFail({ - query: query ?? "undefined", - }); - console.error(readFailMessage); - process.exit(1); - } - - let variables: Record = {}; - - if (task.variables) { - const resolveObjectConstants = ( - constants: Record - ): Record => { - const output: Record = {}; - - Object.keys(constants).forEach((key: string) => { - output[key] = resolveConstant(constants[key]); - }); - - return output; - }; - - const resolveArrayConstants = (arr: unknown[]): unknown[] => { - return arr.map((item) => { - return resolveConstant(item); - }); - }; - - const resolveConstant = (constant: unknown): unknown => { - if (typeof constant === "string" && constant[0] === "$") { - return constants[constant.replace("$", "")]; - } else if (Array.isArray(constant)) { - return resolveArrayConstants(constant); - } else if (typeof constant === "object") { - return resolveObjectConstants(constant as Record); - } else { - return constant; - } - }; - - variables = resolveObjectConstants(task.variables); - } - - if (!uri) { - throw Error(intlMsg.commands_query_error_noApi()); - } - - if (!quiet) { - console.log("-----------------------------------"); - console.log(query); - console.log(JSON.stringify(variables, null, 2)); - console.log("-----------------------------------"); - } - - const { data, errors } = await client.query({ - uri, - query: gql(query), - variables, - }); - - if (outputFile) { - recipeOutput.push({ - query: task.query, - variables: task.variables, - output: { - data, - errors, - }, - }); - } - - if (!quiet && data && data !== {}) { - console.log("-----------------------------------"); - console.log(JSON.stringify(data, null, 2)); - console.log("-----------------------------------"); - } - - if (!quiet && errors) { - for (const error of errors) { - console.log("-----------------------------------"); - console.log(error.message); - console.log(error.stack || ""); - console.log("-----------------------------------"); - } - process.exitCode = 1; - } - } - - if (outputFile) { - const outputFileExt = path.extname(outputFile).substring(1); - if (!outputFileExt) throw new Error("Require output file extention"); - switch (outputFileExt) { - case "yaml": - case "yml": - fs.writeFileSync(outputFile, yaml.dump(recipeOutput)); - break; - case "json": - fs.writeFileSync(outputFile, JSON.stringify(recipeOutput)); - break; - default: - throw new Error(`Unsupported outputFile extention: ${outputFileExt}`); - } - } - } -} diff --git a/packages/cli/src/commands/run.ts b/packages/cli/src/commands/run.ts new file mode 100644 index 0000000000..c8ee40a3b8 --- /dev/null +++ b/packages/cli/src/commands/run.ts @@ -0,0 +1,109 @@ +import { Command, Program } from "./types"; +import { intlMsg } from "../lib"; +import { + parseClientConfigOption, + parseWorkflowOutputFilePathOption, +} from "../lib/parsers"; + +import { InvokeApiResult, Workflow } from "@web3api/core-js"; +import { Web3ApiClient, Web3ApiClientConfig } from "@web3api/client-js"; +import path from "path"; +import yaml from "js-yaml"; +import fs from "fs"; + +type WorkflowCommandOptions = { + clientConfig: Partial; + jobs?: string[]; + outputFile?: string; + quiet?: boolean; +}; + +export const run: Command = { + setup: (program: Program) => { + program + .command("run") + .alias("r") + .description(intlMsg.commands_run_description()) + .argument("", intlMsg.commands_run_options_workflowScript()) + .option( + `-c, --client-config <${intlMsg.commands_run_options_configPath()}> `, + `${intlMsg.commands_run_options_config()}` + ) + .option( + `-o, --output-file <${intlMsg.commands_run_options_outputFilePath()}>`, + `${intlMsg.commands_run_options_outputFile()}` + ) + .option(`-j, --jobs `, intlMsg.commands_run_options_jobs()) + .option(`-q, --quiet`, `${intlMsg.commands_run_options_quiet()}`) + .action(async (workflow: string, options) => { + await _run(workflow, { + ...options, + clientConfig: await parseClientConfigOption( + options.clientConfig, + undefined + ), + outputFile: options.outputFile + ? parseWorkflowOutputFilePathOption(options.outputFile, undefined) + : undefined, + }); + }); + }, +}; + +const _run = async (workflowPath: string, options: WorkflowCommandOptions) => { + const { clientConfig, outputFile, quiet, jobs } = options; + const client = new Web3ApiClient(clientConfig); + + function getParser(path: string) { + return path.endsWith(".yaml") || path.endsWith(".yml") + ? yaml.load + : JSON.parse; + } + + const workflow: Workflow = getParser(workflowPath)( + fs.readFileSync(workflowPath).toString() + ); + const workflowOutput: (InvokeApiResult & { id: string })[] = []; + + await client.run({ + workflow, + config: clientConfig, + ids: jobs, + onExecution: (id, data, error) => { + if (!quiet) { + console.log("-----------------------------------"); + console.log(`ID: ${id}`); + } + + if (!quiet && data && data !== {}) { + console.log(`Data: ${JSON.stringify(data, null, 2)}`); + console.log("-----------------------------------"); + } + + if (!quiet && error) { + console.log(`Error: ${error.message}`); + console.log(error.stack || ""); + console.log("-----------------------------------"); + process.exitCode = 1; + } + + workflowOutput.push({ id, data, error }); + }, + }); + + if (outputFile) { + const outputFileExt = path.extname(outputFile).substring(1); + if (!outputFileExt) throw new Error("Require output file extention"); + switch (outputFileExt) { + case "yaml": + case "yml": + fs.writeFileSync(outputFile, yaml.dump(workflowOutput)); + break; + case "json": + fs.writeFileSync(outputFile, JSON.stringify(workflowOutput, null, 2)); + break; + default: + throw new Error(`Unsupported outputFile extention: ${outputFileExt}`); + } + } +}; diff --git a/packages/cli/src/lib/helpers/validate-client-config.ts b/packages/cli/src/lib/helpers/validate-client-config.ts index 09bab1d7df..60e7007c45 100644 --- a/packages/cli/src/lib/helpers/validate-client-config.ts +++ b/packages/cli/src/lib/helpers/validate-client-config.ts @@ -14,7 +14,7 @@ export function validateRedirects( redirects: UriRedirect[] ): void { if (!Array.isArray(redirects)) { - throw new Error(intlMsg.commands_query_error_redirectsExportNotArray()); + throw new Error(intlMsg.commands_run_error_redirectsExportNotArray()); } // Ensure each redirect in the array is valid @@ -23,19 +23,19 @@ export function validateRedirects( if (typeof redirect !== "object" || !redirect.from || !redirect.to) { throw new Error( - intlMsg.commands_query_error_redirectsItemNotValid({ + intlMsg.commands_run_error_redirectsItemNotValid({ index: i.toString(), }) ); } else if (typeof redirect.from !== "string") { throw new Error( - intlMsg.commands_query_error_redirectsItemFromNotString({ + intlMsg.commands_run_error_redirectsItemFromNotString({ index: i.toString(), }) ); } else if (typeof redirect.to !== "string") { throw new Error( - intlMsg.commands_query_error_redirectsItemToNotStringOrObject({ + intlMsg.commands_run_error_redirectsItemToNotStringOrObject({ index: i.toString(), }) ); @@ -47,7 +47,7 @@ export function validatePlugins( plugins: PluginRegistration[] ): void { if (!Array.isArray(plugins)) { - throw new Error(intlMsg.commands_query_error_pluginsExportNotArray()); + throw new Error(intlMsg.commands_run_error_pluginsExportNotArray()); } // Ensure each plugin in the array is valid @@ -55,31 +55,31 @@ export function validatePlugins( const plugin = plugins[i]; if (typeof plugin !== "object") { throw new Error( - intlMsg.commands_query_error_pluginsItemNotObject({ + intlMsg.commands_run_error_pluginsItemNotObject({ index: i.toString(), }) ); } else if (typeof plugin.uri !== "string") { throw new Error( - intlMsg.commands_query_error_pluginsItemUriNotString({ + intlMsg.commands_run_error_pluginsItemUriNotString({ index: i.toString(), }) ); } else if (typeof plugin.plugin !== "object") { throw new Error( - intlMsg.commands_query_error_pluginsItemPluginNotObject({ + intlMsg.commands_run_error_pluginsItemPluginNotObject({ index: i.toString(), }) ); } else if (typeof plugin.plugin.factory !== "function") { throw new Error( - intlMsg.commands_query_error_pluginsItemPluginFactoryNotFunction({ + intlMsg.commands_run_error_pluginsItemPluginFactoryNotFunction({ index: i.toString(), }) ); } else if (typeof plugin.plugin.manifest !== "object") { throw new Error( - intlMsg.commands_query_error_pluginsItemPluginManifestNotObject({ + intlMsg.commands_run_error_pluginsItemPluginManifestNotObject({ index: i.toString(), }) ); @@ -91,32 +91,32 @@ export function validateInterfaces( interfaces: InterfaceImplementations[] ): void { if (!Array.isArray(interfaces)) { - throw new Error(intlMsg.commands_query_error_interfacesExportNotArray()); + throw new Error(intlMsg.commands_run_error_interfacesExportNotArray()); } // Ensure each interface in the array is valid for (let i = 0; i < interfaces.length; ++i) { const interfaceImplementations = interfaces[i]; if (typeof interfaceImplementations !== "object") { throw new Error( - intlMsg.commands_query_error_interfacesItemNotObject({ + intlMsg.commands_run_error_interfacesItemNotObject({ index: i.toString(), }) ); } else if (typeof interfaceImplementations.interface !== "string") { throw new Error( - intlMsg.commands_query_error_interfacesItemInterfaceNotString({ + intlMsg.commands_run_error_interfacesItemInterfaceNotString({ index: i.toString(), }) ); } else if (!Array.isArray(interfaceImplementations.implementations)) { throw new Error( - intlMsg.commands_query_error_interfacesItemImplementationsNotArray({ + intlMsg.commands_run_error_interfacesItemImplementationsNotArray({ index: i.toString(), }) ); } else if (interfaceImplementations.implementations.length === 0) { throw new Error( - intlMsg.commands_query_error_interfacesItemImplementationsEmpty({ + intlMsg.commands_run_error_interfacesItemImplementationsEmpty({ index: i.toString(), }) ); @@ -125,7 +125,7 @@ export function validateInterfaces( const implementation = interfaceImplementations.implementations[j]; if (typeof implementation !== "string") { throw new Error( - intlMsg.commands_query_error_interfacesItemImplementationsItemNotString( + intlMsg.commands_run_error_interfacesItemImplementationsItemNotString( { index: i.toString(), implementationIndex: j.toString(), @@ -141,37 +141,37 @@ export function validateEnvs( envs: Env[] ): void { if (!Array.isArray(envs)) { - throw new Error(intlMsg.commands_query_error_envsExportNotArray()); + throw new Error(intlMsg.commands_run_error_envsExportNotArray()); } for (let i = 0; i < envs.length; ++i) { const env = envs[i]; if (typeof env !== "object") { throw new Error( - intlMsg.commands_query_error_envsItemNotObject({ + intlMsg.commands_run_error_envsItemNotObject({ index: i.toString(), }) ); } else if (typeof env.uri !== "string") { throw new Error( - intlMsg.commands_query_error_envsItemUriNotString({ + intlMsg.commands_run_error_envsItemUriNotString({ index: i.toString(), }) ); } else if (!env.common && typeof env.common !== "object") { throw new Error( - intlMsg.commands_query_error_envsItemCommonNotObject({ + intlMsg.commands_run_error_envsItemCommonNotObject({ index: i.toString(), }) ); } else if (!env.mutation && typeof env.mutation !== "object") { throw new Error( - intlMsg.commands_query_error_envsItemMutationNotObject({ + intlMsg.commands_run_error_envsItemMutationNotObject({ index: i.toString(), }) ); } else if (!env.query && typeof env.query !== "object") { throw new Error( - intlMsg.commands_query_error_envsItemQueryNotObject({ + intlMsg.commands_run_error_envsItemQueryNotObject({ index: i.toString(), }) ); @@ -183,7 +183,7 @@ export function validateClientConfig( config: Partial ): void { if (!config || typeof config !== "object") { - throw new Error(intlMsg.commands_query_error_clientConfigNotObject()); + throw new Error(intlMsg.commands_run_error_clientConfigNotObject()); } if (config.plugins) validatePlugins(config.plugins); if (config.envs) validateEnvs(config.envs); diff --git a/packages/cli/src/lib/parsers/index.ts b/packages/cli/src/lib/parsers/index.ts index f1b70a6297..f954637a56 100644 --- a/packages/cli/src/lib/parsers/index.ts +++ b/packages/cli/src/lib/parsers/index.ts @@ -3,4 +3,4 @@ export * from "./build"; export * from "./codegen"; export * from "./wasm"; export * from "./plugin"; -export * from "./query"; +export * from "./run"; diff --git a/packages/cli/src/lib/parsers/query.ts b/packages/cli/src/lib/parsers/run.ts similarity index 87% rename from packages/cli/src/lib/parsers/query.ts rename to packages/cli/src/lib/parsers/run.ts index a6210e63c5..49283f8024 100644 --- a/packages/cli/src/lib/parsers/query.ts +++ b/packages/cli/src/lib/parsers/run.ts @@ -8,14 +8,14 @@ import fs from "fs"; import { Web3ApiClientConfig } from "@web3api/client-js"; import { executeMaybeAsyncFunction } from "@web3api/core-js"; -export function parseRecipeScriptPathOption( +export function parseWorkflowScriptPathOption( script: string, _: unknown ): string { const absPath = path.resolve(script); if (!fs.existsSync(absPath)) { throw new Error( - intlMsg.commands_query_error_noRecipeScriptFound({ path: absPath }) + intlMsg.commands_run_error_noWorkflowScriptFound({ path: absPath }) ); } return absPath; @@ -30,7 +30,7 @@ export async function parseClientConfigOption( try { finalClientConfig = await getTestEnvClientConfig(); } catch (e) { - console.error(intlMsg.commands_query_error_noTestEnvFound()); + console.error(intlMsg.commands_run_error_noTestEnvFound()); process.exit(1); } @@ -43,7 +43,7 @@ export async function parseClientConfigOption( } else if (configPath.endsWith(".ts")) { configModule = await importTypescriptModule(path.resolve(configPath)); } else { - const configsModuleMissingExportMessage = intlMsg.commands_query_error_clientConfigInvalidFileExt( + const configsModuleMissingExportMessage = intlMsg.commands_run_error_clientConfigInvalidFileExt( { module: configPath } ); console.error(configsModuleMissingExportMessage); @@ -51,7 +51,7 @@ export async function parseClientConfigOption( } if (!configModule || !configModule.getClientConfig) { - const configsModuleMissingExportMessage = intlMsg.commands_query_error_clientConfigModuleMissingExport( + const configsModuleMissingExportMessage = intlMsg.commands_run_error_clientConfigModuleMissingExport( { module: configModule } ); console.error(configsModuleMissingExportMessage); @@ -80,7 +80,7 @@ export async function defaultClientConfigOption(): Promise< return await parseClientConfigOption(undefined, undefined); } -export function parseRecipeOutputFilePathOption( +export function parseWorkflowOutputFilePathOption( outputFile: string, _: unknown ): string { diff --git a/packages/test-cases/cases/cli/api/query/recipes/constants.json b/packages/test-cases/cases/cli/api/query/recipes/constants.json deleted file mode 100644 index 5c7119e4a6..0000000000 --- a/packages/test-cases/cases/cli/api/query/recipes/constants.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "SimpleStorageAddr": "0x9b1f7F645351AF3631a656421eD2e40f2802E6c0" -} \ No newline at end of file diff --git a/packages/test-cases/cases/cli/api/query/recipes/constants.yaml b/packages/test-cases/cases/cli/api/query/recipes/constants.yaml deleted file mode 100644 index ea1045f842..0000000000 --- a/packages/test-cases/cases/cli/api/query/recipes/constants.yaml +++ /dev/null @@ -1 +0,0 @@ -SimpleStorageAddr: "0x9b1f7F645351AF3631a656421eD2e40f2802E6c0" diff --git a/packages/test-cases/cases/cli/api/query/recipes/e2e.json b/packages/test-cases/cases/cli/api/query/recipes/e2e.json deleted file mode 100644 index 981e187429..0000000000 --- a/packages/test-cases/cases/cli/api/query/recipes/e2e.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "api": "ens/testnet/simplestorage.eth", - "constants": "./constants.json" - }, - { - "query": "./set.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "value": 569, - "network": "testnet" - } - } -] diff --git a/packages/test-cases/cases/cli/api/query/recipes/e2e.yaml b/packages/test-cases/cases/cli/api/query/recipes/e2e.yaml deleted file mode 100644 index 88a98312d3..0000000000 --- a/packages/test-cases/cases/cli/api/query/recipes/e2e.yaml +++ /dev/null @@ -1,7 +0,0 @@ -- api: ens/testnet/simplestorage.eth - constants: ./constants.json -- query: ./set.graphql - variables: - address: $SimpleStorageAddr - value: 569 - network: testnet diff --git a/packages/test-cases/cases/cli/api/query/recipes/get.graphql b/packages/test-cases/cases/cli/api/query/recipes/get.graphql deleted file mode 100644 index 6a1825c6e1..0000000000 --- a/packages/test-cases/cases/cli/api/query/recipes/get.graphql +++ /dev/null @@ -1,8 +0,0 @@ -query { - getData( - address: $address - connection: { - networkNameOrChainId: $network - } - ) -} diff --git a/packages/test-cases/cases/cli/api/query/recipes/set.graphql b/packages/test-cases/cases/cli/api/query/recipes/set.graphql deleted file mode 100644 index 9342655054..0000000000 --- a/packages/test-cases/cases/cli/api/query/recipes/set.graphql +++ /dev/null @@ -1,14 +0,0 @@ -mutation { - setData( - options: { - address: $address - value: $value - } - connection: { - networkNameOrChainId: $network - } - ) { - value - txReceipt - } -} diff --git a/packages/test-cases/cases/cli/api/query/.gitignore b/packages/test-cases/cases/cli/api/run/.gitignore similarity index 100% rename from packages/test-cases/cases/cli/api/query/.gitignore rename to packages/test-cases/cases/cli/api/run/.gitignore diff --git a/packages/test-cases/cases/cli/api/query/client-async-config.js b/packages/test-cases/cases/cli/api/run/client-async-config.js similarity index 100% rename from packages/test-cases/cases/cli/api/query/client-async-config.js rename to packages/test-cases/cases/cli/api/run/client-async-config.js diff --git a/packages/test-cases/cases/cli/api/query/client-async-config.ts b/packages/test-cases/cases/cli/api/run/client-async-config.ts similarity index 100% rename from packages/test-cases/cases/cli/api/query/client-async-config.ts rename to packages/test-cases/cases/cli/api/run/client-async-config.ts diff --git a/packages/test-cases/cases/cli/api/query/client-config.js b/packages/test-cases/cases/cli/api/run/client-config.js similarity index 100% rename from packages/test-cases/cases/cli/api/query/client-config.js rename to packages/test-cases/cases/cli/api/run/client-config.js diff --git a/packages/test-cases/cases/cli/api/query/client-config.ts b/packages/test-cases/cases/cli/api/run/client-config.ts similarity index 100% rename from packages/test-cases/cases/cli/api/query/client-config.ts rename to packages/test-cases/cases/cli/api/run/client-config.ts diff --git a/packages/test-cases/cases/cli/api/query/deploy-contracts.js b/packages/test-cases/cases/cli/api/run/deploy-contracts.js similarity index 100% rename from packages/test-cases/cases/cli/api/query/deploy-contracts.js rename to packages/test-cases/cases/cli/api/run/deploy-contracts.js diff --git a/packages/test-cases/cases/cli/api/query/package.json b/packages/test-cases/cases/cli/api/run/package.json similarity index 100% rename from packages/test-cases/cases/cli/api/query/package.json rename to packages/test-cases/cases/cli/api/run/package.json diff --git a/packages/test-cases/cases/cli/api/query/src/contracts/SimpleStorage.json b/packages/test-cases/cases/cli/api/run/src/contracts/SimpleStorage.json similarity index 100% rename from packages/test-cases/cases/cli/api/query/src/contracts/SimpleStorage.json rename to packages/test-cases/cases/cli/api/run/src/contracts/SimpleStorage.json diff --git a/packages/test-cases/cases/cli/api/query/src/contracts/SimpleStorage.sol b/packages/test-cases/cases/cli/api/run/src/contracts/SimpleStorage.sol similarity index 100% rename from packages/test-cases/cases/cli/api/query/src/contracts/SimpleStorage.sol rename to packages/test-cases/cases/cli/api/run/src/contracts/SimpleStorage.sol diff --git a/packages/test-cases/cases/cli/api/query/src/mutation/index.ts b/packages/test-cases/cases/cli/api/run/src/mutation/index.ts similarity index 100% rename from packages/test-cases/cases/cli/api/query/src/mutation/index.ts rename to packages/test-cases/cases/cli/api/run/src/mutation/index.ts diff --git a/packages/test-cases/cases/cli/api/query/src/mutation/schema.graphql b/packages/test-cases/cases/cli/api/run/src/mutation/schema.graphql similarity index 100% rename from packages/test-cases/cases/cli/api/query/src/mutation/schema.graphql rename to packages/test-cases/cases/cli/api/run/src/mutation/schema.graphql diff --git a/packages/test-cases/cases/cli/api/query/src/query/index.ts b/packages/test-cases/cases/cli/api/run/src/query/index.ts similarity index 100% rename from packages/test-cases/cases/cli/api/query/src/query/index.ts rename to packages/test-cases/cases/cli/api/run/src/query/index.ts diff --git a/packages/test-cases/cases/cli/api/query/src/query/schema.graphql b/packages/test-cases/cases/cli/api/run/src/query/schema.graphql similarity index 100% rename from packages/test-cases/cases/cli/api/query/src/query/schema.graphql rename to packages/test-cases/cases/cli/api/run/src/query/schema.graphql diff --git a/packages/test-cases/cases/cli/api/query/web3api-deploy-fail-between.yaml b/packages/test-cases/cases/cli/api/run/web3api-deploy-fail-between.yaml similarity index 100% rename from packages/test-cases/cases/cli/api/query/web3api-deploy-fail-between.yaml rename to packages/test-cases/cases/cli/api/run/web3api-deploy-fail-between.yaml diff --git a/packages/test-cases/cases/cli/api/query/web3api-deploy-invalid-config.yaml b/packages/test-cases/cases/cli/api/run/web3api-deploy-invalid-config.yaml similarity index 100% rename from packages/test-cases/cases/cli/api/query/web3api-deploy-invalid-config.yaml rename to packages/test-cases/cases/cli/api/run/web3api-deploy-invalid-config.yaml diff --git a/packages/test-cases/cases/cli/api/query/web3api-deploy-no-ext.yaml b/packages/test-cases/cases/cli/api/run/web3api-deploy-no-ext.yaml similarity index 100% rename from packages/test-cases/cases/cli/api/query/web3api-deploy-no-ext.yaml rename to packages/test-cases/cases/cli/api/run/web3api-deploy-no-ext.yaml diff --git a/packages/test-cases/cases/cli/api/query/web3api.build.yaml b/packages/test-cases/cases/cli/api/run/web3api.build.yaml similarity index 100% rename from packages/test-cases/cases/cli/api/query/web3api.build.yaml rename to packages/test-cases/cases/cli/api/run/web3api.build.yaml diff --git a/packages/test-cases/cases/cli/api/query/web3api.deploy.fail-between.yaml b/packages/test-cases/cases/cli/api/run/web3api.deploy.fail-between.yaml similarity index 100% rename from packages/test-cases/cases/cli/api/query/web3api.deploy.fail-between.yaml rename to packages/test-cases/cases/cli/api/run/web3api.deploy.fail-between.yaml diff --git a/packages/test-cases/cases/cli/api/query/web3api.deploy.invalid-config.yaml b/packages/test-cases/cases/cli/api/run/web3api.deploy.invalid-config.yaml similarity index 100% rename from packages/test-cases/cases/cli/api/query/web3api.deploy.invalid-config.yaml rename to packages/test-cases/cases/cli/api/run/web3api.deploy.invalid-config.yaml diff --git a/packages/test-cases/cases/cli/api/query/web3api.deploy.no-ext.yaml b/packages/test-cases/cases/cli/api/run/web3api.deploy.no-ext.yaml similarity index 100% rename from packages/test-cases/cases/cli/api/query/web3api.deploy.no-ext.yaml rename to packages/test-cases/cases/cli/api/run/web3api.deploy.no-ext.yaml diff --git a/packages/test-cases/cases/cli/api/query/web3api.deploy.yaml b/packages/test-cases/cases/cli/api/run/web3api.deploy.yaml similarity index 100% rename from packages/test-cases/cases/cli/api/query/web3api.deploy.yaml rename to packages/test-cases/cases/cli/api/run/web3api.deploy.yaml diff --git a/packages/test-cases/cases/cli/api/query/web3api.yaml b/packages/test-cases/cases/cli/api/run/web3api.yaml similarity index 100% rename from packages/test-cases/cases/cli/api/query/web3api.yaml rename to packages/test-cases/cases/cli/api/run/web3api.yaml diff --git a/packages/test-cases/cases/cli/api/run/workflows/config.ts b/packages/test-cases/cases/cli/api/run/workflows/config.ts new file mode 100644 index 0000000000..ebe136f12d --- /dev/null +++ b/packages/test-cases/cases/cli/api/run/workflows/config.ts @@ -0,0 +1,82 @@ +import { Web3ApiClientConfig } from "@web3api/client-js"; +import { ClientConfig, coreInterfaceUris } from "@web3api/client-js"; +import { ensPlugin } from "@web3api/ens-plugin-js"; +import { ethereumPlugin } from "@web3api/ethereum-plugin-js"; +import { ipfsPlugin } from "@web3api/ipfs-plugin-js"; +import axios from "axios"; + +interface TestEnvironment { + ipfs: string; + ethereum: string; + ensAddress: string; + registrarAddress: string; + reverseAddress: string; + resolverAddress: string; +} + +async function getProviders(): Promise { + const { + data: { ipfs, ethereum }, + } = await axios.get("http://localhost:4040/providers"); + const { data } = await axios.get("http://localhost:4040/deploy-ens"); + const clientConfig: Partial = getPlugins( + ethereum, + ipfs, + data.ensAddress + ); + return { ipfs, ethereum, ...data, clientConfig }; +} + +function getPlugins( + ethereum: string, + ipfs: string, + ensAddress: string +): Partial { + return { + redirects: [], + plugins: [ + { + uri: "w3://ens/ipfs.web3api.eth", + plugin: ipfsPlugin({ provider: ipfs }), + }, + { + uri: "w3://ens/ens.web3api.eth", + plugin: ensPlugin({ query: { addresses: { testnet: ensAddress } } }), + }, + { + uri: "w3://ens/ethereum.web3api.eth", + plugin: ethereumPlugin({ + networks: { + testnet: { + provider: ethereum, + }, + MAINNET: { + provider: "http://localhost:8546", + }, + }, + defaultNetwork: "testnet", + }), + }, + ], + interfaces: [ + { + interface: coreInterfaceUris.uriResolver.uri, + implementations: [ + "w3://ens/ipfs.web3api.eth", + "w3://ens/ens.web3api.eth", + ], + }, + { + interface: coreInterfaceUris.logger.uri, + implementations: ["w3://ens/js-logger.web3api.eth"], + }, + ], + }; +} + +export async function getClientConfig( + defaultConfigs: Partial +): Promise> { + const { ipfs, ethereum, ensAddress } = await getProviders(); + return getPlugins(ethereum, ipfs, ensAddress); +} diff --git a/packages/test-cases/cases/cli/api/run/workflows/e2e.json b/packages/test-cases/cases/cli/api/run/workflows/e2e.json new file mode 100644 index 0000000000..ca60531066 --- /dev/null +++ b/packages/test-cases/cases/cli/api/run/workflows/e2e.json @@ -0,0 +1,39 @@ +{ + "name": "simple-storage", + "jobs": { + "cases": { + "steps": [ + { + "uri": "fs/build", + "module": "mutation", + "method": "deployContract", + "input": { "connection": null } + } + ], + "jobs": { + "case1": { + "steps": [ + { + "uri": "fs/build", + "module": "mutation", + "method": "setData", + "input": { + "options": { + "address": "$cases.0.data", + "value": 100 + }, + "connection": null + } + }, + { + "uri": "fs/build", + "module": "query", + "method": "getData", + "input": { "address": "$cases.0.data", "connection": null } + } + ] + } + } + } + } +} diff --git a/packages/test-cases/cases/cli/api/run/workflows/e2e.yaml b/packages/test-cases/cases/cli/api/run/workflows/e2e.yaml new file mode 100644 index 0000000000..b0b0148046 --- /dev/null +++ b/packages/test-cases/cases/cli/api/run/workflows/e2e.yaml @@ -0,0 +1,26 @@ +name: simple-storage +jobs: + cases: + steps: + - uri: fs/build + module: mutation + method: deployContract + input: + connection: null + jobs: + case1: + steps: + - uri: fs/build + module: mutation + method: setData + input: + options: + address: "$cases.0.data" + value: 100 + connection: null + - uri: fs/build + module: query + method: getData + input: + address: "$cases.0.data" + connection: null From ebd2fe5b043ad7ab4e9fbbaa7d8086835e54374c Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Thu, 9 Jun 2022 19:17:29 +0530 Subject: [PATCH 02/38] fix: template and cli tests --- .../src/__tests__/e2e/query.spec.helper.ts | 109 ------------------ packages/cli/src/__tests__/e2e/run.spec.ts | 4 +- packages/cli/src/__tests__/e2e/utils.ts | 7 ++ .../templates/api/assemblyscript/package.json | 3 +- .../api/assemblyscript/recipes/constants.json | 3 - .../api/assemblyscript/recipes/e2e.json | 43 ------- .../api/assemblyscript/recipes/get.graphql | 8 -- .../api/assemblyscript/recipes/set.graphql | 9 -- .../api/assemblyscript/workflows/config.ts | 82 +++++++++++++ .../api/assemblyscript/workflows/e2e.yaml | 26 +++++ packages/templates/run-tests.ts | 2 +- 11 files changed, 120 insertions(+), 176 deletions(-) delete mode 100644 packages/cli/src/__tests__/e2e/query.spec.helper.ts delete mode 100644 packages/templates/api/assemblyscript/recipes/constants.json delete mode 100644 packages/templates/api/assemblyscript/recipes/e2e.json delete mode 100644 packages/templates/api/assemblyscript/recipes/get.graphql delete mode 100644 packages/templates/api/assemblyscript/recipes/set.graphql create mode 100644 packages/templates/api/assemblyscript/workflows/config.ts create mode 100644 packages/templates/api/assemblyscript/workflows/e2e.yaml diff --git a/packages/cli/src/__tests__/e2e/query.spec.helper.ts b/packages/cli/src/__tests__/e2e/query.spec.helper.ts deleted file mode 100644 index 6094d3673f..0000000000 --- a/packages/cli/src/__tests__/e2e/query.spec.helper.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { normalizeLineEndings } from "@web3api/os-js"; -import { clearStyle } from "./utils"; - -export interface ISampleOutputOptions { - SimpleStorageAddr: string; -} - -export function checkSampleQueryOutput( - output: string, - { SimpleStorageAddr }: ISampleOutputOptions -) { - expect(clearStyle(normalizeLineEndings(output, "\n"))).toContain( - getSampleOutput({ SimpleStorageAddr }) - ); - - expect(clearStyle(output)).toContain(getSampleOutputSetDataValue()); -} - -export function getSampleOutputWithClientConfig( - options: ISampleOutputOptions -): string { - return `----------------------------------- -mutation { - setData( - options: { - address: $address - value: $value - } - connection: { - networkNameOrChainId: $network - } - ) { - value - txReceipt - } -} - -{ - "address": "${options.SimpleStorageAddr}", - "value": 569, - "network": "testnet" -} ------------------------------------ ------------------------------------ -{ - "setData": { - "value": 569, - "txReceipt": "0xdone" - } -} ------------------------------------ -`; -} - -export function getSampleOutput(options: ISampleOutputOptions): string { - return `----------------------------------- -mutation { - setData( - options: { - address: $address - value: $value - } - connection: { - networkNameOrChainId: $network - } - ) { - value - txReceipt - } -} - -{ - "address": "${options.SimpleStorageAddr}", - "value": 569, - "network": "testnet" -} ------------------------------------ ------------------------------------ -{ - "setData": { - "txReceipt": "0x`; -} - -export function getSampleOutputSetDataValue(): string { - return `", - "value": 569 - } -} ------------------------------------ -`; -} - -export function getSampleObjectOutput(): any { - return { - query: "./set.graphql", - variables: { - address: "$SimpleStorageAddr", - value: 569, - network: "testnet", - }, - output: { - data: { - setData: { - value: 569, - }, - }, - }, - }; -} diff --git a/packages/cli/src/__tests__/e2e/run.spec.ts b/packages/cli/src/__tests__/e2e/run.spec.ts index 3d880b74e6..f960dd30ee 100644 --- a/packages/cli/src/__tests__/e2e/run.spec.ts +++ b/packages/cli/src/__tests__/e2e/run.spec.ts @@ -2,7 +2,7 @@ import fs from "fs"; import path from "path"; import yaml from "js-yaml"; -import { parseOutput, w3Cli } from "./utils"; +import { clearStyle, parseOutput, w3Cli } from "./utils"; import { buildAndDeployApi, @@ -42,7 +42,7 @@ describe("sanity tests for workflow command", () => { expect(code).toEqual(0); expect(error).toBe(""); - expect(output).toEqual(HELP); + expect(clearStyle(output)).toEqual(HELP); }); test("Should throw error for missing workflow-string", async () => { diff --git a/packages/cli/src/__tests__/e2e/utils.ts b/packages/cli/src/__tests__/e2e/utils.ts index f3ea73b8ee..7804c263c0 100644 --- a/packages/cli/src/__tests__/e2e/utils.ts +++ b/packages/cli/src/__tests__/e2e/utils.ts @@ -1,3 +1,10 @@ +export const clearStyle = (styled: string) => { + return styled.replace( + /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, + "" + ); +}; + export const parseOutput = ( outputs: string ): Array<{ id: string; data?: unknown, error?: unknown }> => { diff --git a/packages/templates/api/assemblyscript/package.json b/packages/templates/api/assemblyscript/package.json index ec1d6ef930..5dc572b9a2 100644 --- a/packages/templates/api/assemblyscript/package.json +++ b/packages/templates/api/assemblyscript/package.json @@ -15,7 +15,8 @@ "test": "yarn test:e2e && yarn test:recipe", "test:e2e": "yarn build && yarn test:e2e:codegen && jest --passWithNoTests --runInBand --verbose", "test:e2e:codegen": "npx w3 app codegen -m ./src/__tests__/types/web3api.app.yaml -c ./src/__tests__/types/w3", - "test:recipe": "yarn build && yarn test:env:up && yarn deploy:contract && npx w3 query ./recipes/e2e.json && yarn test:env:down" + "test:recipe": "npx w3 run ./workflows/e2e.yaml -c config.ts", + "test:recipe:ci": "yarn build && yarn test:env:up && yarn test:recipe && yarn test:env:down" }, "devDependencies": { "@types/jest": "27.0.3", diff --git a/packages/templates/api/assemblyscript/recipes/constants.json b/packages/templates/api/assemblyscript/recipes/constants.json deleted file mode 100644 index bd46d57bc4..0000000000 --- a/packages/templates/api/assemblyscript/recipes/constants.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "SimpleStorageAddr": "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab" -} \ No newline at end of file diff --git a/packages/templates/api/assemblyscript/recipes/e2e.json b/packages/templates/api/assemblyscript/recipes/e2e.json deleted file mode 100644 index 354abdc098..0000000000 --- a/packages/templates/api/assemblyscript/recipes/e2e.json +++ /dev/null @@ -1,43 +0,0 @@ -[ - { - "api": "w3://fs/./build", - "constants": "./constants.json" - }, - { - "query": "./get.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "network": "testnet" - } - }, - { - "query": "./set.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "value": 5, - "network": "testnet" - } - }, - { - "query": "./get.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "network": "testnet" - } - }, - { - "query": "./set.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "value": 569, - "network": "testnet" - } - }, - { - "query": "./get.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "network": "testnet" - } - } -] diff --git a/packages/templates/api/assemblyscript/recipes/get.graphql b/packages/templates/api/assemblyscript/recipes/get.graphql deleted file mode 100644 index ce22f136be..0000000000 --- a/packages/templates/api/assemblyscript/recipes/get.graphql +++ /dev/null @@ -1,8 +0,0 @@ -query GetData($address: String!) { - getData( - address: $address - connection: { - networkNameOrChainId: $network - } - ) -} diff --git a/packages/templates/api/assemblyscript/recipes/set.graphql b/packages/templates/api/assemblyscript/recipes/set.graphql deleted file mode 100644 index d5c8f9a896..0000000000 --- a/packages/templates/api/assemblyscript/recipes/set.graphql +++ /dev/null @@ -1,9 +0,0 @@ -mutation SetData($address: String!, $value: Int!) { - setData( - address: $address - value: $value - connection: { - networkNameOrChainId: $network - } - ) -} diff --git a/packages/templates/api/assemblyscript/workflows/config.ts b/packages/templates/api/assemblyscript/workflows/config.ts new file mode 100644 index 0000000000..ebe136f12d --- /dev/null +++ b/packages/templates/api/assemblyscript/workflows/config.ts @@ -0,0 +1,82 @@ +import { Web3ApiClientConfig } from "@web3api/client-js"; +import { ClientConfig, coreInterfaceUris } from "@web3api/client-js"; +import { ensPlugin } from "@web3api/ens-plugin-js"; +import { ethereumPlugin } from "@web3api/ethereum-plugin-js"; +import { ipfsPlugin } from "@web3api/ipfs-plugin-js"; +import axios from "axios"; + +interface TestEnvironment { + ipfs: string; + ethereum: string; + ensAddress: string; + registrarAddress: string; + reverseAddress: string; + resolverAddress: string; +} + +async function getProviders(): Promise { + const { + data: { ipfs, ethereum }, + } = await axios.get("http://localhost:4040/providers"); + const { data } = await axios.get("http://localhost:4040/deploy-ens"); + const clientConfig: Partial = getPlugins( + ethereum, + ipfs, + data.ensAddress + ); + return { ipfs, ethereum, ...data, clientConfig }; +} + +function getPlugins( + ethereum: string, + ipfs: string, + ensAddress: string +): Partial { + return { + redirects: [], + plugins: [ + { + uri: "w3://ens/ipfs.web3api.eth", + plugin: ipfsPlugin({ provider: ipfs }), + }, + { + uri: "w3://ens/ens.web3api.eth", + plugin: ensPlugin({ query: { addresses: { testnet: ensAddress } } }), + }, + { + uri: "w3://ens/ethereum.web3api.eth", + plugin: ethereumPlugin({ + networks: { + testnet: { + provider: ethereum, + }, + MAINNET: { + provider: "http://localhost:8546", + }, + }, + defaultNetwork: "testnet", + }), + }, + ], + interfaces: [ + { + interface: coreInterfaceUris.uriResolver.uri, + implementations: [ + "w3://ens/ipfs.web3api.eth", + "w3://ens/ens.web3api.eth", + ], + }, + { + interface: coreInterfaceUris.logger.uri, + implementations: ["w3://ens/js-logger.web3api.eth"], + }, + ], + }; +} + +export async function getClientConfig( + defaultConfigs: Partial +): Promise> { + const { ipfs, ethereum, ensAddress } = await getProviders(); + return getPlugins(ethereum, ipfs, ensAddress); +} diff --git a/packages/templates/api/assemblyscript/workflows/e2e.yaml b/packages/templates/api/assemblyscript/workflows/e2e.yaml new file mode 100644 index 0000000000..b0b0148046 --- /dev/null +++ b/packages/templates/api/assemblyscript/workflows/e2e.yaml @@ -0,0 +1,26 @@ +name: simple-storage +jobs: + cases: + steps: + - uri: fs/build + module: mutation + method: deployContract + input: + connection: null + jobs: + case1: + steps: + - uri: fs/build + module: mutation + method: setData + input: + options: + address: "$cases.0.data" + value: 100 + connection: null + - uri: fs/build + module: query + method: getData + input: + address: "$cases.0.data" + connection: null diff --git a/packages/templates/run-tests.ts b/packages/templates/run-tests.ts index fca9ea4762..1e9318faeb 100644 --- a/packages/templates/run-tests.ts +++ b/packages/templates/run-tests.ts @@ -19,7 +19,7 @@ const languageTestCommands: Record = { "assemblyscript": [ "yarn build", "yarn test:e2e", - "yarn test:recipe" + "yarn test:recipe:ci" ], "interface": [ "yarn build" From 8f59388f9f89c24b5059a9cf57849d643347638f Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Thu, 9 Jun 2022 19:18:32 +0530 Subject: [PATCH 03/38] chore: fix typo --- packages/templates/api/assemblyscript/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/templates/api/assemblyscript/package.json b/packages/templates/api/assemblyscript/package.json index 5dc572b9a2..7ed77a855c 100644 --- a/packages/templates/api/assemblyscript/package.json +++ b/packages/templates/api/assemblyscript/package.json @@ -15,7 +15,7 @@ "test": "yarn test:e2e && yarn test:recipe", "test:e2e": "yarn build && yarn test:e2e:codegen && jest --passWithNoTests --runInBand --verbose", "test:e2e:codegen": "npx w3 app codegen -m ./src/__tests__/types/web3api.app.yaml -c ./src/__tests__/types/w3", - "test:recipe": "npx w3 run ./workflows/e2e.yaml -c config.ts", + "test:recipe": "npx w3 run ./workflows/e2e.yaml -c ./workflows/config.ts", "test:recipe:ci": "yarn build && yarn test:env:up && yarn test:recipe && yarn test:env:down" }, "devDependencies": { From e4eab34dd0060ee8d00fff364f2ae22c60aa725c Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Fri, 10 Jun 2022 16:07:12 +0530 Subject: [PATCH 04/38] chore: fix merge issues --- packages/cli/src/commands/run.ts | 4 ++-- packages/cli/src/lib/{parsers => option-parsers}/run.ts | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename packages/cli/src/lib/{parsers => option-parsers}/run.ts (100%) diff --git a/packages/cli/src/commands/run.ts b/packages/cli/src/commands/run.ts index c8ee40a3b8..54f87d8a24 100644 --- a/packages/cli/src/commands/run.ts +++ b/packages/cli/src/commands/run.ts @@ -1,9 +1,9 @@ import { Command, Program } from "./types"; -import { intlMsg } from "../lib"; import { + intlMsg, parseClientConfigOption, parseWorkflowOutputFilePathOption, -} from "../lib/parsers"; +} from "../lib"; import { InvokeApiResult, Workflow } from "@web3api/core-js"; import { Web3ApiClient, Web3ApiClientConfig } from "@web3api/client-js"; diff --git a/packages/cli/src/lib/parsers/run.ts b/packages/cli/src/lib/option-parsers/run.ts similarity index 100% rename from packages/cli/src/lib/parsers/run.ts rename to packages/cli/src/lib/option-parsers/run.ts From cb953720f53d8d91e0adb7d69c99d12e0622bc6a Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Fri, 10 Jun 2022 21:50:08 +0530 Subject: [PATCH 05/38] feat(cli): add support for output validation for workflows --- packages/cli/lang/en.json | 5 ++ packages/cli/lang/es.json | 9 ++- packages/cli/src/__tests__/e2e/run.spec.ts | 71 +++++++++++++------ packages/cli/src/commands/run.ts | 28 ++++++-- packages/cli/src/lib/helpers/index.ts | 1 + .../cli/src/lib/helpers/workflow-validator.ts | 42 +++++++++++ packages/cli/src/lib/option-parsers/run.ts | 15 ++++ .../cases/cli/api/run/workflows/config.ts | 20 +++--- .../cases/cli/api/run/workflows/validator.cue | 22 ++++++ 9 files changed, 177 insertions(+), 36 deletions(-) create mode 100644 packages/cli/src/lib/helpers/workflow-validator.ts create mode 100644 packages/test-cases/cases/cli/api/run/workflows/validator.cue diff --git a/packages/cli/lang/en.json b/packages/cli/lang/en.json index 67573333c7..da46b9728f 100644 --- a/packages/cli/lang/en.json +++ b/packages/cli/lang/en.json @@ -139,13 +139,18 @@ "commands_plugin_options_path": "path", "commands_plugin_options_publish": "Output path for the built schema and manifest (default: {default})", "commands_plugin_options_codegen": "Output directory for the generated types (default: {default})", + "commands_run_options_workflow": "workflow", "commands_run_options_workflowScript": "Path to workflow script", "commands_run_options_configPath": "config-path", "commands_run_options_outputFilePath": "output-file-path", "commands_run_options_config": "Add custom configuration to the Web3ApiClient", + "commands_run_options_validateScript": "Validate the output of the workflow jobs", + "commands_run_options_validate": "cue-file", "commands_run_options_outputFile": "Output file path for the workflow result", "commands_run_options_quiet": "Suppress output", + "commands_run_options_jobIds": "jobs", "commands_run_options_jobs": "Specify ids of jobs that you want to run", + "commands_run_error_validatorNotFound": "validate script not found at: {path}", "commands_run_error_outputFileMissing": "{option} option missing {argument} argument", "commands_run_error_clientConfigMissingPath": "{option} option missing {argument} argument", "commands_run_error_clientConfigModuleMissingExport": "Custom client config module missing named export 'getClientConfig' at {module}", diff --git a/packages/cli/lang/es.json b/packages/cli/lang/es.json index 2f392e889b..da46b9728f 100644 --- a/packages/cli/lang/es.json +++ b/packages/cli/lang/es.json @@ -13,7 +13,6 @@ "commands_build_options_t": "Use the development server's ENS instance", "commands_build_options_w": "Automatically rebuild when changes are made (default: false)", "commands_build_options_v": "Verbose output (default: false)", - "commands_build_uriViewers": "URI Viewers", "commands_infra_description": "Manage infrastructure for your Web3API", "commands_infra_actions_subtitle": "Infra allows you to execute the following commands:", "commands_infra_options_options": "options", @@ -52,6 +51,7 @@ "commands_infra_manifest_text": "Aggregating manifest", "commands_infra_manifest_warning": "Warning aggregating manifest", "commands_infra_manifest_error": "Error aggregating manifest", + "commands_build_uriViewers": "URI Viewers", "commands_deploy_description": "Deploys/Publishes a Web3API", "commands_deploy_options_options": "options", "commands_deploy_options_o_path": "path", @@ -139,13 +139,18 @@ "commands_plugin_options_path": "path", "commands_plugin_options_publish": "Output path for the built schema and manifest (default: {default})", "commands_plugin_options_codegen": "Output directory for the generated types (default: {default})", + "commands_run_options_workflow": "workflow", "commands_run_options_workflowScript": "Path to workflow script", "commands_run_options_configPath": "config-path", "commands_run_options_outputFilePath": "output-file-path", "commands_run_options_config": "Add custom configuration to the Web3ApiClient", - "commands_run_options_outputFile": "Output file path for the query result", + "commands_run_options_validateScript": "Validate the output of the workflow jobs", + "commands_run_options_validate": "cue-file", + "commands_run_options_outputFile": "Output file path for the workflow result", "commands_run_options_quiet": "Suppress output", + "commands_run_options_jobIds": "jobs", "commands_run_options_jobs": "Specify ids of jobs that you want to run", + "commands_run_error_validatorNotFound": "validate script not found at: {path}", "commands_run_error_outputFileMissing": "{option} option missing {argument} argument", "commands_run_error_clientConfigMissingPath": "{option} option missing {argument} argument", "commands_run_error_clientConfigModuleMissingExport": "Custom client config module missing named export 'getClientConfig' at {module}", diff --git a/packages/cli/src/__tests__/e2e/run.spec.ts b/packages/cli/src/__tests__/e2e/run.spec.ts index f960dd30ee..f614d7d742 100644 --- a/packages/cli/src/__tests__/e2e/run.spec.ts +++ b/packages/cli/src/__tests__/e2e/run.spec.ts @@ -23,6 +23,8 @@ Arguments: Options: -c, --client-config Add custom configuration to the Web3ApiClient + -v, --validate Validate the output of the workflow + jobs -o, --output-file Output file path for the workflow result -j, --jobs Specify ids of jobs that you want to @@ -34,7 +36,7 @@ Options: describe("sanity tests for workflow command", () => { const testCaseRoot = path.join(GetPathToCliTestFiles(), "api/run"); - test("Should show help text", async () => { + it("Should show help text", async () => { const { exitCode: code, stdout: output, stderr: error } = await runCLI({ args: ["run", "--help"], cwd: testCaseRoot, @@ -45,7 +47,7 @@ describe("sanity tests for workflow command", () => { expect(clearStyle(output)).toEqual(HELP); }); - test("Should throw error for missing workflow-string", async () => { + it("Should throw error for missing workflow-string", async () => { const { exitCode, stdout, stderr } = await runCLI({ args: ["run"], cwd: testCaseRoot, @@ -57,7 +59,7 @@ describe("sanity tests for workflow command", () => { expect(stdout).toEqual(``); }); - test("Should throw error is --client-config doesn't contain arguments", async () => { + it("Should throw error is --client-config doesn't contain arguments", async () => { const { exitCode, stdout, stderr } = await runCLI({ args: ["run", "./recipes/e2e.json", "--client-config"], cwd: testCaseRoot, @@ -76,21 +78,12 @@ describe("e2e tests for run command", () => { const testCaseRoot = path.join(GetPathToCliTestFiles(), "api/run"); beforeAll(async () => { - const { - ipfs, - ethereum, - ensAddress: ens, - registrarAddress, - resolverAddress, - } = await initTestEnvironment(); + await initTestEnvironment(); await buildAndDeployApi({ apiAbsPath: testCaseRoot, - ipfsProvider: ipfs, - ethereumProvider: ethereum, - ensRegistrarAddress: registrarAddress, - ensResolverAddress: resolverAddress, - ensRegistryAddress: ens, + ipfsProvider: "http://localhost:5001", + ethereumProvider: "http://localhost:8545", ensName: "simple-storage.eth", }); }); @@ -103,7 +96,7 @@ describe("e2e tests for run command", () => { }); }); - test("Should successfully return response: using json workflow", async () => { + it("Should successfully return response: using json workflow", async () => { const { exitCode: code, stdout, stderr } = await runCLI({ args: ["run", "./workflows/e2e.json", "-c", "./workflows/config.ts"], cwd: testCaseRoot, @@ -120,7 +113,7 @@ describe("e2e tests for run command", () => { expect(output).toHaveLength(3); }, 480000); - test("Should successfully return response: using yaml workflow", async () => { + it("Should successfully return response: using yaml workflow", async () => { const { exitCode: code, stdout, stderr } = await runCLI({ args: ["run", "./workflows/e2e.yaml", "-c", "./workflows/config.ts"], cwd: testCaseRoot, @@ -138,7 +131,7 @@ describe("e2e tests for run command", () => { expect(output).toHaveLength(3); }, 480000); - test("Should successfully create json output file if specified", async () => { + it("Should successfully create json output file if specified", async () => { const { exitCode: code, stdout, stderr } = await runCLI({ args: [ "run", @@ -166,7 +159,7 @@ describe("e2e tests for run command", () => { fs.unlinkSync(`${testCaseRoot}/workflows/output.json`); }, 48000); - test("Should successfully create yaml output file if specified", async () => { + it("Should successfully create yaml output file if specified", async () => { const { exitCode: code, stdout, stderr } = await runCLI({ args: [ "run", @@ -198,7 +191,7 @@ describe("e2e tests for run command", () => { fs.unlinkSync(`${testCaseRoot}/workflows/output.yaml`); }, 48000); - test("Should suppress the ouput if --quiet option is specified", async () => { + it("Should suppress the ouput if --quiet option is specified", async () => { const { exitCode: code, stdout, stderr } = await runCLI({ args: [ "run", @@ -215,4 +208,42 @@ describe("e2e tests for run command", () => { expect(stderr).toBe(""); expect(stdout).toBeFalsy(); }, 48000); + + it("Should validate output if validate script given", async () => { + const { exitCode: code, stdout, stderr } = await runCLI({ + args: [ + "run", + "./workflows/e2e.json", + "-c", + "./workflows/config.ts", + "-v", + "./workflows/validator.cue", + "-q", + ], + cwd: testCaseRoot, + cli: w3Cli, + }); + + expect(code).toEqual(0); + expect(stderr).toBe(""); + expect(stdout).toBe(""); + + }, 48000); + + it("Should print error on stderr if validation fails", async () => { + const { exitCode: code, stderr } = await runCLI({ + args: [ + "run", + "./workflows/e2e.json", + "-v", + "./workflows/validator.cue", + "-q", + ], + cwd: testCaseRoot, + cli: w3Cli, + }); + + expect(code).toEqual(1); + expect(stderr).toContain("explicit error (_|_ literal) in source:"); + }, 48000); }); diff --git a/packages/cli/src/commands/run.ts b/packages/cli/src/commands/run.ts index 54f87d8a24..fda20c37f9 100644 --- a/packages/cli/src/commands/run.ts +++ b/packages/cli/src/commands/run.ts @@ -2,7 +2,9 @@ import { Command, Program } from "./types"; import { intlMsg, parseClientConfigOption, + parseValidateScriptOption, parseWorkflowOutputFilePathOption, + validateOutput, } from "../lib"; import { InvokeApiResult, Workflow } from "@web3api/core-js"; @@ -14,6 +16,7 @@ import fs from "fs"; type WorkflowCommandOptions = { clientConfig: Partial; jobs?: string[]; + validateScript?: string; outputFile?: string; quiet?: boolean; }; @@ -24,16 +27,26 @@ export const run: Command = { .command("run") .alias("r") .description(intlMsg.commands_run_description()) - .argument("", intlMsg.commands_run_options_workflowScript()) + .argument( + `<${intlMsg.commands_run_options_workflow()}>`, + intlMsg.commands_run_options_workflowScript() + ) .option( `-c, --client-config <${intlMsg.commands_run_options_configPath()}> `, `${intlMsg.commands_run_options_config()}` ) + .option( + `-v, --validate-script <${intlMsg.commands_run_options_validate()}>`, + `${intlMsg.commands_run_options_validateScript()}` + ) .option( `-o, --output-file <${intlMsg.commands_run_options_outputFilePath()}>`, `${intlMsg.commands_run_options_outputFile()}` ) - .option(`-j, --jobs `, intlMsg.commands_run_options_jobs()) + .option( + `-j, --jobs <${intlMsg.commands_run_options_jobIds()}...>`, + intlMsg.commands_run_options_jobs() + ) .option(`-q, --quiet`, `${intlMsg.commands_run_options_quiet()}`) .action(async (workflow: string, options) => { await _run(workflow, { @@ -45,13 +58,16 @@ export const run: Command = { outputFile: options.outputFile ? parseWorkflowOutputFilePathOption(options.outputFile, undefined) : undefined, + validateScript: options.validateScript + ? parseValidateScriptOption(options.validateScript, undefined) + : undefined, }); }); }, }; const _run = async (workflowPath: string, options: WorkflowCommandOptions) => { - const { clientConfig, outputFile, quiet, jobs } = options; + const { clientConfig, outputFile, validateScript, quiet, jobs } = options; const client = new Web3ApiClient(clientConfig); function getParser(path: string) { @@ -69,7 +85,7 @@ const _run = async (workflowPath: string, options: WorkflowCommandOptions) => { workflow, config: clientConfig, ids: jobs, - onExecution: (id, data, error) => { + onExecution: async (id, data, error) => { if (!quiet) { console.log("-----------------------------------"); console.log(`ID: ${id}`); @@ -87,6 +103,10 @@ const _run = async (workflowPath: string, options: WorkflowCommandOptions) => { process.exitCode = 1; } + if (validateScript) { + await validateOutput(id, { data, error }, validateScript); + } + workflowOutput.push({ id, data, error }); }, }); diff --git a/packages/cli/src/lib/helpers/index.ts b/packages/cli/src/lib/helpers/index.ts index a3485cc82d..6b07ba8337 100644 --- a/packages/cli/src/lib/helpers/index.ts +++ b/packages/cli/src/lib/helpers/index.ts @@ -4,3 +4,4 @@ export * from "./parameters"; export * from "./spinner"; export * from "./uuid"; export * from "./validate-client-config"; +export * from "./workflow-validator"; diff --git a/packages/cli/src/lib/helpers/workflow-validator.ts b/packages/cli/src/lib/helpers/workflow-validator.ts new file mode 100644 index 0000000000..f9ebbb5618 --- /dev/null +++ b/packages/cli/src/lib/helpers/workflow-validator.ts @@ -0,0 +1,42 @@ +import { runCommand } from "../system"; + +import fs from "fs"; +import { InvokeApiResult } from "@web3api/core-js"; + +export async function cueExists(): Promise { + try { + const { stdout } = await runCommand("cue version"); + return stdout.startsWith("cue version "); + } catch (e) { + return false; + } +} + +export async function validateOutput( + id: string, + result: InvokeApiResult, + validateScriptPath: string +): Promise { + const index = id.lastIndexOf("."); + const jobId = id.substring(0, index); + const stepId = id.substring(index + 1); + + const selector = `${jobId}.\\$${stepId}`; + const jsonOutput = `${process.env.TMPDIR}/${id}.json`; + + await fs.promises.writeFile(jsonOutput, JSON.stringify(result, null, 2)); + + try { + await runCommand( + `cue vet -d ${selector} ${validateScriptPath} ${jsonOutput}` + ); + } catch (e) { + console.error(e.message); + console.log("-----------------------------------"); + process.exitCode = 1; + } + + if (fs.existsSync(jsonOutput)) { + await fs.promises.unlink(jsonOutput); + } +} diff --git a/packages/cli/src/lib/option-parsers/run.ts b/packages/cli/src/lib/option-parsers/run.ts index 49283f8024..a56c077ffc 100644 --- a/packages/cli/src/lib/option-parsers/run.ts +++ b/packages/cli/src/lib/option-parsers/run.ts @@ -86,3 +86,18 @@ export function parseWorkflowOutputFilePathOption( ): string { return path.resolve(outputFile); } + +export function parseValidateScriptOption(cueFile: string, _: unknown): string { + const cueFilepath = path.resolve(cueFile); + + if (!fs.existsSync(cueFilepath)) { + console.error( + intlMsg.commands_run_error_validatorNotFound({ + path: cueFilepath, + }) + ); + process.exit(1); + } + + return cueFilepath; +} diff --git a/packages/test-cases/cases/cli/api/run/workflows/config.ts b/packages/test-cases/cases/cli/api/run/workflows/config.ts index ebe136f12d..abbc812b75 100644 --- a/packages/test-cases/cases/cli/api/run/workflows/config.ts +++ b/packages/test-cases/cases/cli/api/run/workflows/config.ts @@ -3,28 +3,28 @@ import { ClientConfig, coreInterfaceUris } from "@web3api/client-js"; import { ensPlugin } from "@web3api/ens-plugin-js"; import { ethereumPlugin } from "@web3api/ethereum-plugin-js"; import { ipfsPlugin } from "@web3api/ipfs-plugin-js"; -import axios from "axios"; interface TestEnvironment { ipfs: string; ethereum: string; ensAddress: string; - registrarAddress: string; - reverseAddress: string; - resolverAddress: string; + registrarAddress?: string; + reverseAddress?: string; + resolverAddress?: string; + clientConfig: Partial; } async function getProviders(): Promise { - const { - data: { ipfs, ethereum }, - } = await axios.get("http://localhost:4040/providers"); - const { data } = await axios.get("http://localhost:4040/deploy-ens"); + const ipfs = "http://localhost:5001"; + const ethereum = "http://localhost:8545"; + const ensAddress = "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab"; + const clientConfig: Partial = getPlugins( ethereum, ipfs, - data.ensAddress + "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab" ); - return { ipfs, ethereum, ...data, clientConfig }; + return { ipfs, ethereum, ensAddress, clientConfig }; } function getPlugins( diff --git a/packages/test-cases/cases/cli/api/run/workflows/validator.cue b/packages/test-cases/cases/cli/api/run/workflows/validator.cue new file mode 100644 index 0000000000..c9486a6bfe --- /dev/null +++ b/packages/test-cases/cases/cli/api/run/workflows/validator.cue @@ -0,0 +1,22 @@ +package e2e + +cases: { + $0: { + data: =~"^0x[A-Fa-f0-9]{40}$", + error?: _|_, // Never fails + } + case1: { + $0: { + data: { + txReceipt: =~"^0x[A-Fa-f0-9]{64}$", + value: uint + }, + error?: _|_, + } + $1: { + data: uint, + error?: _|_ + } + } +} + From 552584f485ad44fd722bcb10bea9f58148dd9954 Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Fri, 10 Jun 2022 21:52:19 +0530 Subject: [PATCH 06/38] fix(cli): no-command help test --- packages/cli/src/__tests__/e2e/no-command.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/__tests__/e2e/no-command.spec.ts b/packages/cli/src/__tests__/e2e/no-command.spec.ts index 8e24df77fb..1f83ca11db 100644 --- a/packages/cli/src/__tests__/e2e/no-command.spec.ts +++ b/packages/cli/src/__tests__/e2e/no-command.spec.ts @@ -15,8 +15,8 @@ Commands: create|c Create a new project with w3 CLI deploy|d [options] Deploys/Publishes a Web3API plugin|p Build/generate types for the plugin - query|q [options] Query Web3APIs using recipe scripts infra|i [options] Manage infrastructure for your Web3API + run|r [options] Runs workflow script help [command] display help for command `; From aa68c1db4646987d83a9be5d52fa560a80ab78b2 Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Fri, 10 Jun 2022 22:16:05 +0530 Subject: [PATCH 07/38] fix(templates): assemblyscript example template --- .../api/assemblyscript/workflows/config.ts | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/templates/api/assemblyscript/workflows/config.ts b/packages/templates/api/assemblyscript/workflows/config.ts index ebe136f12d..f4aabada9e 100644 --- a/packages/templates/api/assemblyscript/workflows/config.ts +++ b/packages/templates/api/assemblyscript/workflows/config.ts @@ -3,28 +3,28 @@ import { ClientConfig, coreInterfaceUris } from "@web3api/client-js"; import { ensPlugin } from "@web3api/ens-plugin-js"; import { ethereumPlugin } from "@web3api/ethereum-plugin-js"; import { ipfsPlugin } from "@web3api/ipfs-plugin-js"; -import axios from "axios"; interface TestEnvironment { ipfs: string; ethereum: string; ensAddress: string; - registrarAddress: string; - reverseAddress: string; - resolverAddress: string; + registrarAddress?: string; + reverseAddress?: string; + resolverAddress?: string; + clientConfig: Partial; } async function getProviders(): Promise { - const { - data: { ipfs, ethereum }, - } = await axios.get("http://localhost:4040/providers"); - const { data } = await axios.get("http://localhost:4040/deploy-ens"); + const ipfs = "http://localhost:5001"; + const ethereum = "http://localhost:8545"; + const ensAddress = "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab"; + const clientConfig: Partial = getPlugins( ethereum, ipfs, - data.ensAddress + "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab" ); - return { ipfs, ethereum, ...data, clientConfig }; + return { ipfs, ethereum, ensAddress, clientConfig }; } function getPlugins( @@ -75,7 +75,7 @@ function getPlugins( } export async function getClientConfig( - defaultConfigs: Partial + _: Partial ): Promise> { const { ipfs, ethereum, ensAddress } = await getProviders(); return getPlugins(ethereum, ipfs, ensAddress); From 79f31674fac9c136ab053d07c95622e2ecdc8c4c Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Sat, 11 Jun 2022 00:57:14 +0530 Subject: [PATCH 08/38] fix(cli): tests --- .github/workflows/js-ci.yaml | 7 +++++++ packages/cli/src/__tests__/e2e/help.spec.ts | 2 +- packages/cli/src/__tests__/e2e/run.spec.ts | 2 +- packages/templates/api/assemblyscript/workflows/e2e.yaml | 5 ++--- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/js-ci.yaml b/.github/workflows/js-ci.yaml index ae9497024c..2c8eaad11a 100644 --- a/.github/workflows/js-ci.yaml +++ b/.github/workflows/js-ci.yaml @@ -169,6 +169,13 @@ jobs: with: node-version: '${{ steps.nvm.outputs.NVMRC }}' + - uses: actions/setup-go@v3 + with: + go-version: '^1.13.1' + + - name: Install cue lang + run: go install cuelang.org/go/cmd/cue@latest + - name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" diff --git a/packages/cli/src/__tests__/e2e/help.spec.ts b/packages/cli/src/__tests__/e2e/help.spec.ts index 8d6ad83a66..5a8cf9fb06 100644 --- a/packages/cli/src/__tests__/e2e/help.spec.ts +++ b/packages/cli/src/__tests__/e2e/help.spec.ts @@ -15,8 +15,8 @@ Commands: create|c Create a new project with w3 CLI deploy|d [options] Deploys/Publishes a Web3API plugin|p Build/generate types for the plugin - query|q [options] Query Web3APIs using recipe scripts infra|i [options] Manage infrastructure for your Web3API + run|r [options] Runs workflow script help [command] display help for command `; diff --git a/packages/cli/src/__tests__/e2e/run.spec.ts b/packages/cli/src/__tests__/e2e/run.spec.ts index f614d7d742..d99222bf84 100644 --- a/packages/cli/src/__tests__/e2e/run.spec.ts +++ b/packages/cli/src/__tests__/e2e/run.spec.ts @@ -23,7 +23,7 @@ Arguments: Options: -c, --client-config Add custom configuration to the Web3ApiClient - -v, --validate Validate the output of the workflow + -v, --validate-script Validate the output of the workflow jobs -o, --output-file Output file path for the workflow result diff --git a/packages/templates/api/assemblyscript/workflows/e2e.yaml b/packages/templates/api/assemblyscript/workflows/e2e.yaml index b0b0148046..45c360716b 100644 --- a/packages/templates/api/assemblyscript/workflows/e2e.yaml +++ b/packages/templates/api/assemblyscript/workflows/e2e.yaml @@ -14,9 +14,8 @@ jobs: module: mutation method: setData input: - options: - address: "$cases.0.data" - value: 100 + address: "$cases.0.data" + value: 100 connection: null - uri: fs/build module: query From 095f39a756c00c3eacf64ad20cc2da5b8a79b3ca Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Mon, 13 Jun 2022 15:01:05 +0530 Subject: [PATCH 09/38] debug(cli): cue validator --- .github/workflows/js-ci.yaml | 3 +++ packages/cli/src/__tests__/e2e/run.spec.ts | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/.github/workflows/js-ci.yaml b/.github/workflows/js-ci.yaml index 2c8eaad11a..b303be57f2 100644 --- a/.github/workflows/js-ci.yaml +++ b/.github/workflows/js-ci.yaml @@ -175,6 +175,9 @@ jobs: - name: Install cue lang run: go install cuelang.org/go/cmd/cue@latest + + - name: Check if cue is installed + run: cue version - name: Get yarn cache directory path id: yarn-cache-dir-path diff --git a/packages/cli/src/__tests__/e2e/run.spec.ts b/packages/cli/src/__tests__/e2e/run.spec.ts index d99222bf84..ff2e647c20 100644 --- a/packages/cli/src/__tests__/e2e/run.spec.ts +++ b/packages/cli/src/__tests__/e2e/run.spec.ts @@ -224,6 +224,11 @@ describe("e2e tests for run command", () => { cli: w3Cli, }); + console.log("STDOUT") + console.log(stdout) + console.log("STDERR") + console.log(stderr) + expect(code).toEqual(0); expect(stderr).toBe(""); expect(stdout).toBe(""); @@ -243,6 +248,9 @@ describe("e2e tests for run command", () => { cli: w3Cli, }); + console.log("STDERR") + console.log(stderr) + expect(code).toEqual(1); expect(stderr).toContain("explicit error (_|_ literal) in source:"); }, 48000); From 89394e349cc2e2149028ca116826941202b792f1 Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Mon, 13 Jun 2022 15:51:37 +0530 Subject: [PATCH 10/38] fix(templates): recipe tests Running Recipe just after starting test-env doesn't guarantee all the necessary services has started and since test-env-js comes with awaiter that makes surethe services has started, it's better to test it in jest. --- .../templates/api/assemblyscript/package.json | 1 - .../src/__tests__/e2e/integration.spec.ts | 18 +++++++++++++++++- .../api/assemblyscript/workflows/config.ts | 9 ++------- packages/templates/run-tests.ts | 1 - 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/packages/templates/api/assemblyscript/package.json b/packages/templates/api/assemblyscript/package.json index 21c8902cdc..eb7b820caa 100644 --- a/packages/templates/api/assemblyscript/package.json +++ b/packages/templates/api/assemblyscript/package.json @@ -16,7 +16,6 @@ "test:e2e": "yarn build && yarn test:e2e:codegen && jest --passWithNoTests --runInBand --verbose", "test:e2e:codegen": "npx w3 app codegen -m ./src/__tests__/types/web3api.app.yaml -c ./src/__tests__/types/w3", "test:recipe": "npx w3 run ./workflows/e2e.yaml -c ./workflows/config.ts", - "test:recipe:ci": "yarn build && yarn test:env:up && yarn test:recipe && yarn test:env:down" }, "devDependencies": { "@types/jest": "27.0.3", diff --git a/packages/templates/api/assemblyscript/src/__tests__/e2e/integration.spec.ts b/packages/templates/api/assemblyscript/src/__tests__/e2e/integration.spec.ts index 28cfb0da32..c4c3edbadf 100644 --- a/packages/templates/api/assemblyscript/src/__tests__/e2e/integration.spec.ts +++ b/packages/templates/api/assemblyscript/src/__tests__/e2e/integration.spec.ts @@ -4,7 +4,8 @@ import { initTestEnvironment, stopTestEnvironment, providers, - ensAddresses + ensAddresses, + runCLI } from "@web3api/test-env-js"; import * as App from "../types/w3"; import path from "path"; @@ -99,4 +100,19 @@ describe("SimpleStorage", () => { data = await getData(contractAddress); expect(data).toBe(10); }); + + test("e2e sanity", async () => { + const {stderr, stdout} = await runCLI({ + args: [ + "run", + "./workflows/e2e.yaml", + "-c", + "./workflows/config.ts", + ], + cwd: path.resolve(__dirname, "..", "..", ".."), + }); + + console.log(stderr); + console.log(stdout); + }) }); diff --git a/packages/templates/api/assemblyscript/workflows/config.ts b/packages/templates/api/assemblyscript/workflows/config.ts index f4aabada9e..d143db8cc8 100644 --- a/packages/templates/api/assemblyscript/workflows/config.ts +++ b/packages/templates/api/assemblyscript/workflows/config.ts @@ -11,7 +11,6 @@ interface TestEnvironment { registrarAddress?: string; reverseAddress?: string; resolverAddress?: string; - clientConfig: Partial; } async function getProviders(): Promise { @@ -19,12 +18,7 @@ async function getProviders(): Promise { const ethereum = "http://localhost:8545"; const ensAddress = "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab"; - const clientConfig: Partial = getPlugins( - ethereum, - ipfs, - "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab" - ); - return { ipfs, ethereum, ensAddress, clientConfig }; + return { ipfs, ethereum, ensAddress }; } function getPlugins( @@ -78,5 +72,6 @@ export async function getClientConfig( _: Partial ): Promise> { const { ipfs, ethereum, ensAddress } = await getProviders(); + return getPlugins(ethereum, ipfs, ensAddress); } diff --git a/packages/templates/run-tests.ts b/packages/templates/run-tests.ts index 1e9318faeb..6a1562020a 100644 --- a/packages/templates/run-tests.ts +++ b/packages/templates/run-tests.ts @@ -19,7 +19,6 @@ const languageTestCommands: Record = { "assemblyscript": [ "yarn build", "yarn test:e2e", - "yarn test:recipe:ci" ], "interface": [ "yarn build" From 0b2dd51ad3b7f1a491a1e0ec229137f94663b78f Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Mon, 13 Jun 2022 15:54:42 +0530 Subject: [PATCH 11/38] fix(cli): tempdir not set issue --- packages/cli/src/lib/helpers/workflow-validator.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/lib/helpers/workflow-validator.ts b/packages/cli/src/lib/helpers/workflow-validator.ts index f9ebbb5618..704c64ae9a 100644 --- a/packages/cli/src/lib/helpers/workflow-validator.ts +++ b/packages/cli/src/lib/helpers/workflow-validator.ts @@ -3,6 +3,8 @@ import { runCommand } from "../system"; import fs from "fs"; import { InvokeApiResult } from "@web3api/core-js"; +const TMPDIR = process.env.TMPDIR || "/tmp"; + export async function cueExists(): Promise { try { const { stdout } = await runCommand("cue version"); @@ -22,7 +24,7 @@ export async function validateOutput( const stepId = id.substring(index + 1); const selector = `${jobId}.\\$${stepId}`; - const jsonOutput = `${process.env.TMPDIR}/${id}.json`; + const jsonOutput = `${TMPDIR}/${id}.json`; await fs.promises.writeFile(jsonOutput, JSON.stringify(result, null, 2)); From a8a557f9bc0256bbf95f31f613e79d0ed0f5bc98 Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Mon, 13 Jun 2022 15:55:59 +0530 Subject: [PATCH 12/38] chore: fix typo in package.json --- packages/templates/api/assemblyscript/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/templates/api/assemblyscript/package.json b/packages/templates/api/assemblyscript/package.json index eb7b820caa..56aca12489 100644 --- a/packages/templates/api/assemblyscript/package.json +++ b/packages/templates/api/assemblyscript/package.json @@ -15,7 +15,7 @@ "test": "yarn test:e2e && yarn test:recipe", "test:e2e": "yarn build && yarn test:e2e:codegen && jest --passWithNoTests --runInBand --verbose", "test:e2e:codegen": "npx w3 app codegen -m ./src/__tests__/types/web3api.app.yaml -c ./src/__tests__/types/w3", - "test:recipe": "npx w3 run ./workflows/e2e.yaml -c ./workflows/config.ts", + "test:recipe": "npx w3 run ./workflows/e2e.yaml -c ./workflows/config.ts" }, "devDependencies": { "@types/jest": "27.0.3", From 366fc4f83725df62c0ae48404fcfebbfcb7254a8 Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Fri, 17 Jun 2022 16:20:33 +0530 Subject: [PATCH 13/38] refactor: remove debugging logs --- packages/cli/src/__tests__/e2e/run.spec.ts | 8 -------- yarn.lock | 11 ----------- 2 files changed, 19 deletions(-) diff --git a/packages/cli/src/__tests__/e2e/run.spec.ts b/packages/cli/src/__tests__/e2e/run.spec.ts index ff2e647c20..d99222bf84 100644 --- a/packages/cli/src/__tests__/e2e/run.spec.ts +++ b/packages/cli/src/__tests__/e2e/run.spec.ts @@ -224,11 +224,6 @@ describe("e2e tests for run command", () => { cli: w3Cli, }); - console.log("STDOUT") - console.log(stdout) - console.log("STDERR") - console.log(stderr) - expect(code).toEqual(0); expect(stderr).toBe(""); expect(stdout).toBe(""); @@ -248,9 +243,6 @@ describe("e2e tests for run command", () => { cli: w3Cli, }); - console.log("STDERR") - console.log(stderr) - expect(code).toEqual(1); expect(stderr).toContain("explicit error (_|_ literal) in source:"); }, 48000); diff --git a/yarn.lock b/yarn.lock index 4aabc88617..c194eb2d47 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3950,17 +3950,6 @@ "@web3api/assemblyscript-json" "1.2.0" as-base64 "^0.2.0" -"@web3api/wasm-as@0.0.1-prealpha.84": - version "0.0.1-prealpha.84" - resolved "https://registry.yarnpkg.com/@web3api/wasm-as/-/wasm-as-0.0.1-prealpha.84.tgz#db7fe81d857d6605adec3e632f16e3ddb2d6a873" - integrity sha512-xKRqrMVFVeU68qpsDFJ6rNZHJxHNB0Tm6F4fIxEvW2/cL2uvWJmG6Nf0A1vUm1BERrdMKlF6PL/ZZxj6FlTZag== - dependencies: - "@serial-as/transform" "1.0.2" - "@web3api/serial-as-json" "1.0.4" - as-bigint "0.5.3" - as-bignumber "0.2.0" - as-container "0.6.1" - "@webassemblyjs/ast@1.8.5": version "1.8.5" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.8.5.tgz#51b1c5fe6576a34953bf4b253df9f0d490d9e359" From dc1eff0487cd82761647367da479fb279bfcd1cc Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Mon, 20 Jun 2022 12:03:44 +0400 Subject: [PATCH 14/38] fix: issues --- packages/cli/src/commands/run.ts | 10 +- .../cli/src/lib/helpers/workflow-validator.ts | 4 +- packages/cli/src/lib/option-parsers/run.ts | 8 +- packages/js/plugins/ens/src/w3/index.ts | 9 - packages/js/plugins/ens/src/w3/manifest.ts | 16 - packages/js/plugins/ens/src/w3/module.ts | 36 - packages/js/plugins/ens/src/w3/schema.ts | 396 ----------- packages/js/plugins/ens/src/w3/types.ts | 673 ------------------ packages/js/plugins/ethereum/src/w3/index.ts | 9 - .../js/plugins/ethereum/src/w3/manifest.ts | 15 - packages/js/plugins/ethereum/src/w3/module.ts | 305 -------- packages/js/plugins/ethereum/src/w3/schema.ts | 305 -------- packages/js/plugins/ethereum/src/w3/types.ts | 145 ---- .../js/plugins/filesystem/src/w3/index.ts | 9 - .../js/plugins/filesystem/src/w3/manifest.ts | 16 - .../js/plugins/filesystem/src/w3/module.ts | 36 - .../js/plugins/filesystem/src/w3/schema.ts | 88 --- .../js/plugins/filesystem/src/w3/types.ts | 85 --- .../js/plugins/graph-node/src/w3/index.ts | 9 - .../js/plugins/graph-node/src/w3/manifest.ts | 15 - .../js/plugins/graph-node/src/w3/module.ts | 28 - .../js/plugins/graph-node/src/w3/schema.ts | 130 ---- .../js/plugins/graph-node/src/w3/types.ts | 120 ---- packages/js/plugins/http/src/w3/index.ts | 9 - packages/js/plugins/http/src/w3/manifest.ts | 15 - packages/js/plugins/http/src/w3/module.ts | 37 - packages/js/plugins/http/src/w3/schema.ts | 89 --- packages/js/plugins/http/src/w3/types.ts | 78 -- packages/js/plugins/ipfs/src/w3/index.ts | 9 - packages/js/plugins/ipfs/src/w3/manifest.ts | 16 - packages/js/plugins/ipfs/src/w3/module.ts | 66 -- packages/js/plugins/ipfs/src/w3/schema.ts | 130 ---- packages/js/plugins/ipfs/src/w3/types.ts | 99 --- packages/js/plugins/logger/src/w3/index.ts | 9 - packages/js/plugins/logger/src/w3/manifest.ts | 16 - packages/js/plugins/logger/src/w3/module.ts | 27 - packages/js/plugins/logger/src/w3/schema.ts | 82 --- packages/js/plugins/logger/src/w3/types.ts | 79 -- packages/js/plugins/sha3/src/w3/index.ts | 9 - packages/js/plugins/sha3/src/w3/manifest.ts | 15 - packages/js/plugins/sha3/src/w3/module.ts | 127 ---- packages/js/plugins/sha3/src/w3/schema.ts | 100 --- packages/js/plugins/sha3/src/w3/types.ts | 43 -- packages/js/plugins/uts46/src/w3/index.ts | 9 - packages/js/plugins/uts46/src/w3/manifest.ts | 15 - packages/js/plugins/uts46/src/w3/module.ts | 44 -- packages/js/plugins/uts46/src/w3/schema.ts | 67 -- packages/js/plugins/uts46/src/w3/types.ts | 48 -- 48 files changed, 11 insertions(+), 3694 deletions(-) delete mode 100644 packages/js/plugins/ens/src/w3/index.ts delete mode 100644 packages/js/plugins/ens/src/w3/manifest.ts delete mode 100644 packages/js/plugins/ens/src/w3/module.ts delete mode 100644 packages/js/plugins/ens/src/w3/schema.ts delete mode 100644 packages/js/plugins/ens/src/w3/types.ts delete mode 100644 packages/js/plugins/ethereum/src/w3/index.ts delete mode 100644 packages/js/plugins/ethereum/src/w3/manifest.ts delete mode 100644 packages/js/plugins/ethereum/src/w3/module.ts delete mode 100644 packages/js/plugins/ethereum/src/w3/schema.ts delete mode 100644 packages/js/plugins/ethereum/src/w3/types.ts delete mode 100644 packages/js/plugins/filesystem/src/w3/index.ts delete mode 100644 packages/js/plugins/filesystem/src/w3/manifest.ts delete mode 100644 packages/js/plugins/filesystem/src/w3/module.ts delete mode 100644 packages/js/plugins/filesystem/src/w3/schema.ts delete mode 100644 packages/js/plugins/filesystem/src/w3/types.ts delete mode 100644 packages/js/plugins/graph-node/src/w3/index.ts delete mode 100644 packages/js/plugins/graph-node/src/w3/manifest.ts delete mode 100644 packages/js/plugins/graph-node/src/w3/module.ts delete mode 100644 packages/js/plugins/graph-node/src/w3/schema.ts delete mode 100644 packages/js/plugins/graph-node/src/w3/types.ts delete mode 100644 packages/js/plugins/http/src/w3/index.ts delete mode 100644 packages/js/plugins/http/src/w3/manifest.ts delete mode 100644 packages/js/plugins/http/src/w3/module.ts delete mode 100644 packages/js/plugins/http/src/w3/schema.ts delete mode 100644 packages/js/plugins/http/src/w3/types.ts delete mode 100644 packages/js/plugins/ipfs/src/w3/index.ts delete mode 100644 packages/js/plugins/ipfs/src/w3/manifest.ts delete mode 100644 packages/js/plugins/ipfs/src/w3/module.ts delete mode 100644 packages/js/plugins/ipfs/src/w3/schema.ts delete mode 100644 packages/js/plugins/ipfs/src/w3/types.ts delete mode 100644 packages/js/plugins/logger/src/w3/index.ts delete mode 100644 packages/js/plugins/logger/src/w3/manifest.ts delete mode 100644 packages/js/plugins/logger/src/w3/module.ts delete mode 100644 packages/js/plugins/logger/src/w3/schema.ts delete mode 100644 packages/js/plugins/logger/src/w3/types.ts delete mode 100644 packages/js/plugins/sha3/src/w3/index.ts delete mode 100644 packages/js/plugins/sha3/src/w3/manifest.ts delete mode 100644 packages/js/plugins/sha3/src/w3/module.ts delete mode 100644 packages/js/plugins/sha3/src/w3/schema.ts delete mode 100644 packages/js/plugins/sha3/src/w3/types.ts delete mode 100644 packages/js/plugins/uts46/src/w3/index.ts delete mode 100644 packages/js/plugins/uts46/src/w3/manifest.ts delete mode 100644 packages/js/plugins/uts46/src/w3/module.ts delete mode 100644 packages/js/plugins/uts46/src/w3/schema.ts delete mode 100644 packages/js/plugins/uts46/src/w3/types.ts diff --git a/packages/cli/src/commands/run.ts b/packages/cli/src/commands/run.ts index fda20c37f9..b5f52265f4 100644 --- a/packages/cli/src/commands/run.ts +++ b/packages/cli/src/commands/run.ts @@ -7,14 +7,14 @@ import { validateOutput, } from "../lib"; -import { InvokeApiResult, Workflow } from "@web3api/core-js"; -import { Web3ApiClient, Web3ApiClientConfig } from "@web3api/client-js"; +import { InvokeResult, Workflow } from "@web3api/core-js"; +import { PolywrapClient, PolywrapClientConfig } from "@web3api/client-js"; import path from "path"; import yaml from "js-yaml"; import fs from "fs"; type WorkflowCommandOptions = { - clientConfig: Partial; + clientConfig: Partial; jobs?: string[]; validateScript?: string; outputFile?: string; @@ -68,7 +68,7 @@ export const run: Command = { const _run = async (workflowPath: string, options: WorkflowCommandOptions) => { const { clientConfig, outputFile, validateScript, quiet, jobs } = options; - const client = new Web3ApiClient(clientConfig); + const client = new PolywrapClient(clientConfig); function getParser(path: string) { return path.endsWith(".yaml") || path.endsWith(".yml") @@ -79,7 +79,7 @@ const _run = async (workflowPath: string, options: WorkflowCommandOptions) => { const workflow: Workflow = getParser(workflowPath)( fs.readFileSync(workflowPath).toString() ); - const workflowOutput: (InvokeApiResult & { id: string })[] = []; + const workflowOutput: (InvokeResult & { id: string })[] = []; await client.run({ workflow, diff --git a/packages/cli/src/lib/helpers/workflow-validator.ts b/packages/cli/src/lib/helpers/workflow-validator.ts index 704c64ae9a..4622415c2e 100644 --- a/packages/cli/src/lib/helpers/workflow-validator.ts +++ b/packages/cli/src/lib/helpers/workflow-validator.ts @@ -1,7 +1,7 @@ import { runCommand } from "../system"; import fs from "fs"; -import { InvokeApiResult } from "@web3api/core-js"; +import { InvokeResult } from "@web3api/core-js"; const TMPDIR = process.env.TMPDIR || "/tmp"; @@ -16,7 +16,7 @@ export async function cueExists(): Promise { export async function validateOutput( id: string, - result: InvokeApiResult, + result: InvokeResult, validateScriptPath: string ): Promise { const index = id.lastIndexOf("."); diff --git a/packages/cli/src/lib/option-parsers/run.ts b/packages/cli/src/lib/option-parsers/run.ts index a56c077ffc..322a60667f 100644 --- a/packages/cli/src/lib/option-parsers/run.ts +++ b/packages/cli/src/lib/option-parsers/run.ts @@ -5,7 +5,7 @@ import { validateClientConfig } from "../helpers"; import path from "path"; import fs from "fs"; -import { Web3ApiClientConfig } from "@web3api/client-js"; +import { PolywrapClientConfig } from "@web3api/client-js"; import { executeMaybeAsyncFunction } from "@web3api/core-js"; export function parseWorkflowScriptPathOption( @@ -24,8 +24,8 @@ export function parseWorkflowScriptPathOption( export async function parseClientConfigOption( _clientConfig: string | undefined, _: unknown -): Promise> { - let finalClientConfig: Partial; +): Promise> { + let finalClientConfig: Partial; try { finalClientConfig = await getTestEnvClientConfig(); @@ -75,7 +75,7 @@ export async function parseClientConfigOption( } export async function defaultClientConfigOption(): Promise< - Partial + Partial > { return await parseClientConfigOption(undefined, undefined); } diff --git a/packages/js/plugins/ens/src/w3/index.ts b/packages/js/plugins/ens/src/w3/index.ts deleted file mode 100644 index ff371c0cd8..0000000000 --- a/packages/js/plugins/ens/src/w3/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@web3api/core-js"; diff --git a/packages/js/plugins/ens/src/w3/manifest.ts b/packages/js/plugins/ens/src/w3/manifest.ts deleted file mode 100644 index de0f50a4ec..0000000000 --- a/packages/js/plugins/ens/src/w3/manifest.ts +++ /dev/null @@ -1,16 +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 "@web3api/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - new Uri("ens/uri-resolver.core.web3api.eth"), - ], -}; diff --git a/packages/js/plugins/ens/src/w3/module.ts b/packages/js/plugins/ens/src/w3/module.ts deleted file mode 100644 index 849fe3d8ed..0000000000 --- a/packages/js/plugins/ens/src/w3/module.ts +++ /dev/null @@ -1,36 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -import * as Types from "./types"; - -import { - Client, - PluginModule, - MaybeAsync -} from "@web3api/core-js"; - -export interface Input_tryResolveUri extends Record { - authority: Types.String; - path: Types.String; -} - -export interface Input_getFile extends Record { - path: Types.String; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule< - TConfig -> { - - abstract tryResolveUri( - input: Input_tryResolveUri, - client: Client - ): MaybeAsync; - - abstract getFile( - input: Input_getFile, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/ens/src/w3/schema.ts b/packages/js/plugins/ens/src/w3/schema.ts deleted file mode 100644 index 64891a8dc7..0000000000 --- a/packages/js/plugins/ens/src/w3/schema.ts +++ /dev/null @@ -1,396 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `### Web3API 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 - -### Web3API Header END ### - -type Module implements UriResolver_Module @imports( - types: [ - "UriResolver_Module", - "UriResolver_MaybeUriOrManifest", - "Ethereum_Module", - "Ethereum_Connection", - "Ethereum_TxOverrides", - "Ethereum_StaticTxResult", - "Ethereum_TxRequest", - "Ethereum_TxReceipt", - "Ethereum_Log", - "Ethereum_EventNotification", - "Ethereum_Network", - "Ethereum_TxResponse", - "Ethereum_Access" - ] -) { - tryResolveUri( - authority: String! - path: String! - ): UriResolver_MaybeUriOrManifest - - getFile( - path: String! - ): Bytes -} - -### Imported Modules START ### - -type UriResolver_Module @imported( - uri: "ens/uri-resolver.core.web3api.eth", - namespace: "UriResolver", - nativeType: "Module" -) { - tryResolveUri( - authority: String! - path: String! - ): UriResolver_MaybeUriOrManifest - - getFile( - path: String! - ): Bytes -} - -type Ethereum_Module @imported( - uri: "ens/ethereum.web3api.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! - - 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 UriResolver_MaybeUriOrManifest @imported( - uri: "ens/uri-resolver.core.web3api.eth", - namespace: "UriResolver", - nativeType: "MaybeUriOrManifest" -) { - uri: String - manifest: String -} - -type Ethereum_Connection @imported( - uri: "ens/ethereum.web3api.eth", - namespace: "Ethereum", - nativeType: "Connection" -) { - node: String - networkNameOrChainId: String -} - -type Ethereum_TxOverrides @imported( - uri: "ens/ethereum.web3api.eth", - namespace: "Ethereum", - nativeType: "TxOverrides" -) { - gasLimit: BigInt - gasPrice: BigInt - value: BigInt -} - -type Ethereum_StaticTxResult @imported( - uri: "ens/ethereum.web3api.eth", - namespace: "Ethereum", - nativeType: "StaticTxResult" -) { - result: String! - error: Boolean! -} - -type Ethereum_TxRequest @imported( - uri: "ens/ethereum.web3api.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.web3api.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.web3api.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.web3api.eth", - namespace: "Ethereum", - nativeType: "EventNotification" -) { - data: String! - address: String! - log: Ethereum_Log! -} - -type Ethereum_Network @imported( - uri: "ens/ethereum.web3api.eth", - namespace: "Ethereum", - nativeType: "Network" -) { - name: String! - chainId: BigInt! - ensAddress: String -} - -type Ethereum_TxResponse @imported( - uri: "ens/ethereum.web3api.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.web3api.eth", - namespace: "Ethereum", - nativeType: "Access" -) { - address: String! - storageKeys: [String!]! -} - -### Imported Objects END ### -`; diff --git a/packages/js/plugins/ens/src/w3/types.ts b/packages/js/plugins/ens/src/w3/types.ts deleted file mode 100644 index 4e272e6287..0000000000 --- a/packages/js/plugins/ens/src/w3/types.ts +++ /dev/null @@ -1,673 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -// @ts-ignore -import * as Types from "./"; - -// @ts-ignore -import { - Client, - InvokeApiResult -} from "@web3api/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 = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -/// Envs END /// - -/// Objects START /// -/// Objects END /// - -/// Enums START /// -/// Enums END /// - -/// Imported Objects START /// - -/* URI: "ens/uri-resolver.core.web3api.eth" */ -export interface UriResolver_MaybeUriOrManifest { - uri?: Types.String | null; - manifest?: Types.String | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -export interface Ethereum_Connection { - node?: Types.String | null; - networkNameOrChainId?: Types.String | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -export interface Ethereum_TxOverrides { - gasLimit?: Types.BigInt | null; - gasPrice?: Types.BigInt | null; - value?: Types.BigInt | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -export interface Ethereum_StaticTxResult { - result: Types.String; - error: Types.Boolean; -} - -/* URI: "ens/ethereum.web3api.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.web3api.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.web3api.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.web3api.eth" */ -export interface Ethereum_EventNotification { - data: Types.String; - address: Types.String; - log: Types.Ethereum_Log; -} - -/* URI: "ens/ethereum.web3api.eth" */ -export interface Ethereum_Network { - name: Types.String; - chainId: Types.BigInt; - ensAddress?: Types.String | null; -} - -/* URI: "ens/ethereum.web3api.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.web3api.eth" */ -export interface Ethereum_Access { - address: Types.String; - storageKeys: Array; -} - -/// Imported Objects END /// - -/// Imported Modules START /// - -/* URI: "ens/uri-resolver.core.web3api.eth" */ -interface UriResolver_Module_Input_tryResolveUri extends Record { - authority: Types.String; - path: Types.String; -} - -/* URI: "ens/uri-resolver.core.web3api.eth" */ -interface UriResolver_Module_Input_getFile extends Record { - path: Types.String; -} - -/* URI: "ens/uri-resolver.core.web3api.eth" */ -export const UriResolver_Module = { - tryResolveUri: async ( - input: UriResolver_Module_Input_tryResolveUri, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/uri-resolver.core.web3api.eth", - method: "tryResolveUri", - input - }); - }, - - getFile: async ( - input: UriResolver_Module_Input_getFile, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/uri-resolver.core.web3api.eth", - method: "getFile", - input - }); - } -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_callContractView extends Record { - address: Types.String; - method: Types.String; - args?: Array | null; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_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.web3api.eth" */ -interface Ethereum_Module_Input_getBalance extends Record { - address: Types.String; - blockTag?: Types.BigInt | null; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_encodeParams extends Record { - types: Array; - values: Array; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_encodeFunction extends Record { - method: Types.String; - args?: Array | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_solidityPack extends Record { - types: Array; - values: Array; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_solidityKeccak256 extends Record { - types: Array; - values: Array; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_soliditySha256 extends Record { - types: Array; - values: Array; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_getSignerAddress extends Record { - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_getSignerBalance extends Record { - blockTag?: Types.BigInt | null; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_getSignerTransactionCount extends Record { - blockTag?: Types.BigInt | null; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_getGasPrice extends Record { - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_estimateTransactionGas extends Record { - tx: Types.Ethereum_TxRequest; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_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.web3api.eth" */ -interface Ethereum_Module_Input_checkAddress extends Record { - address: Types.String; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_toWei extends Record { - eth: Types.String; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_toEth extends Record { - wei: Types.BigInt; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_awaitTransaction extends Record { - txHash: Types.String; - confirmations: Types.UInt32; - timeout: Types.UInt32; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_waitForEvent extends Record { - address: Types.String; - event: Types.String; - args?: Array | null; - timeout?: Types.UInt32 | null; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_getNetwork extends Record { - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_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.web3api.eth" */ -interface Ethereum_Module_Input_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.web3api.eth" */ -interface Ethereum_Module_Input_sendTransaction extends Record { - tx: Types.Ethereum_TxRequest; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_sendTransactionAndWait extends Record { - tx: Types.Ethereum_TxRequest; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_deployContract extends Record { - abi: Types.String; - bytecode: Types.String; - args?: Array | null; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_signMessage extends Record { - message: Types.String; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -interface Ethereum_Module_Input_sendRPC extends Record { - method: Types.String; - params: Array; - connection?: Types.Ethereum_Connection | null; -} - -/* URI: "ens/ethereum.web3api.eth" */ -export const Ethereum_Module = { - callContractView: async ( - input: Ethereum_Module_Input_callContractView, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "callContractView", - input - }); - }, - - callContractStatic: async ( - input: Ethereum_Module_Input_callContractStatic, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "callContractStatic", - input - }); - }, - - getBalance: async ( - input: Ethereum_Module_Input_getBalance, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "getBalance", - input - }); - }, - - encodeParams: async ( - input: Ethereum_Module_Input_encodeParams, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "encodeParams", - input - }); - }, - - encodeFunction: async ( - input: Ethereum_Module_Input_encodeFunction, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "encodeFunction", - input - }); - }, - - solidityPack: async ( - input: Ethereum_Module_Input_solidityPack, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "solidityPack", - input - }); - }, - - solidityKeccak256: async ( - input: Ethereum_Module_Input_solidityKeccak256, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "solidityKeccak256", - input - }); - }, - - soliditySha256: async ( - input: Ethereum_Module_Input_soliditySha256, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "soliditySha256", - input - }); - }, - - getSignerAddress: async ( - input: Ethereum_Module_Input_getSignerAddress, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "getSignerAddress", - input - }); - }, - - getSignerBalance: async ( - input: Ethereum_Module_Input_getSignerBalance, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "getSignerBalance", - input - }); - }, - - getSignerTransactionCount: async ( - input: Ethereum_Module_Input_getSignerTransactionCount, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "getSignerTransactionCount", - input - }); - }, - - getGasPrice: async ( - input: Ethereum_Module_Input_getGasPrice, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "getGasPrice", - input - }); - }, - - estimateTransactionGas: async ( - input: Ethereum_Module_Input_estimateTransactionGas, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "estimateTransactionGas", - input - }); - }, - - estimateContractCallGas: async ( - input: Ethereum_Module_Input_estimateContractCallGas, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "estimateContractCallGas", - input - }); - }, - - checkAddress: async ( - input: Ethereum_Module_Input_checkAddress, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "checkAddress", - input - }); - }, - - toWei: async ( - input: Ethereum_Module_Input_toWei, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "toWei", - input - }); - }, - - toEth: async ( - input: Ethereum_Module_Input_toEth, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "toEth", - input - }); - }, - - awaitTransaction: async ( - input: Ethereum_Module_Input_awaitTransaction, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "awaitTransaction", - input - }); - }, - - waitForEvent: async ( - input: Ethereum_Module_Input_waitForEvent, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "waitForEvent", - input - }); - }, - - getNetwork: async ( - input: Ethereum_Module_Input_getNetwork, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "getNetwork", - input - }); - }, - - callContractMethod: async ( - input: Ethereum_Module_Input_callContractMethod, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "callContractMethod", - input - }); - }, - - callContractMethodAndWait: async ( - input: Ethereum_Module_Input_callContractMethodAndWait, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "callContractMethodAndWait", - input - }); - }, - - sendTransaction: async ( - input: Ethereum_Module_Input_sendTransaction, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "sendTransaction", - input - }); - }, - - sendTransactionAndWait: async ( - input: Ethereum_Module_Input_sendTransactionAndWait, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "sendTransactionAndWait", - input - }); - }, - - deployContract: async ( - input: Ethereum_Module_Input_deployContract, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "deployContract", - input - }); - }, - - signMessage: async ( - input: Ethereum_Module_Input_signMessage, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "signMessage", - input - }); - }, - - sendRPC: async ( - input: Ethereum_Module_Input_sendRPC, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/ethereum.web3api.eth", - method: "sendRPC", - input - }); - } -} - -/// Imported Modules END /// diff --git a/packages/js/plugins/ethereum/src/w3/index.ts b/packages/js/plugins/ethereum/src/w3/index.ts deleted file mode 100644 index ff371c0cd8..0000000000 --- a/packages/js/plugins/ethereum/src/w3/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@web3api/core-js"; diff --git a/packages/js/plugins/ethereum/src/w3/manifest.ts b/packages/js/plugins/ethereum/src/w3/manifest.ts deleted file mode 100644 index 4d35c2182f..0000000000 --- a/packages/js/plugins/ethereum/src/w3/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 "@web3api/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - ], -}; diff --git a/packages/js/plugins/ethereum/src/w3/module.ts b/packages/js/plugins/ethereum/src/w3/module.ts deleted file mode 100644 index 2493fcb3a5..0000000000 --- a/packages/js/plugins/ethereum/src/w3/module.ts +++ /dev/null @@ -1,305 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -import * as Types from "./types"; - -import { - Client, - PluginModule, - MaybeAsync -} from "@web3api/core-js"; - -export interface Input_callContractView extends Record { - address: Types.String; - method: Types.String; - args?: Array | null; - connection?: Types.Connection | null; -} - -export interface Input_callContractStatic extends Record { - address: Types.String; - method: Types.String; - args?: Array | null; - connection?: Types.Connection | null; - txOverrides?: Types.TxOverrides | null; -} - -export interface Input_getBalance extends Record { - address: Types.String; - blockTag?: Types.BigInt | null; - connection?: Types.Connection | null; -} - -export interface Input_encodeParams extends Record { - types: Array; - values: Array; -} - -export interface Input_encodeFunction extends Record { - method: Types.String; - args?: Array | null; -} - -export interface Input_solidityPack extends Record { - types: Array; - values: Array; -} - -export interface Input_solidityKeccak256 extends Record { - types: Array; - values: Array; -} - -export interface Input_soliditySha256 extends Record { - types: Array; - values: Array; -} - -export interface Input_getSignerAddress extends Record { - connection?: Types.Connection | null; -} - -export interface Input_getSignerBalance extends Record { - blockTag?: Types.BigInt | null; - connection?: Types.Connection | null; -} - -export interface Input_getSignerTransactionCount extends Record { - blockTag?: Types.BigInt | null; - connection?: Types.Connection | null; -} - -export interface Input_getGasPrice extends Record { - connection?: Types.Connection | null; -} - -export interface Input_estimateTransactionGas extends Record { - tx: Types.TxRequest; - connection?: Types.Connection | null; -} - -export interface Input_estimateContractCallGas extends Record { - address: Types.String; - method: Types.String; - args?: Array | null; - connection?: Types.Connection | null; - txOverrides?: Types.TxOverrides | null; -} - -export interface Input_checkAddress extends Record { - address: Types.String; -} - -export interface Input_toWei extends Record { - eth: Types.String; -} - -export interface Input_toEth extends Record { - wei: Types.BigInt; -} - -export interface Input_awaitTransaction extends Record { - txHash: Types.String; - confirmations: Types.UInt32; - timeout: Types.UInt32; - connection?: Types.Connection | null; -} - -export interface Input_waitForEvent extends Record { - address: Types.String; - event: Types.String; - args?: Array | null; - timeout?: Types.UInt32 | null; - connection?: Types.Connection | null; -} - -export interface Input_getNetwork extends Record { - connection?: Types.Connection | null; -} - -export interface Input_callContractMethod extends Record { - address: Types.String; - method: Types.String; - args?: Array | null; - connection?: Types.Connection | null; - txOverrides?: Types.TxOverrides | null; -} - -export interface Input_callContractMethodAndWait extends Record { - address: Types.String; - method: Types.String; - args?: Array | null; - connection?: Types.Connection | null; - txOverrides?: Types.TxOverrides | null; -} - -export interface Input_sendTransaction extends Record { - tx: Types.TxRequest; - connection?: Types.Connection | null; -} - -export interface Input_sendTransactionAndWait extends Record { - tx: Types.TxRequest; - connection?: Types.Connection | null; -} - -export interface Input_deployContract extends Record { - abi: Types.String; - bytecode: Types.String; - args?: Array | null; - connection?: Types.Connection | null; -} - -export interface Input_signMessage extends Record { - message: Types.String; - connection?: Types.Connection | null; -} - -export interface Input_sendRPC extends Record { - method: Types.String; - params: Array; - connection?: Types.Connection | null; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule< - TConfig, - Types.Env -> { - - abstract callContractView( - input: Input_callContractView, - client: Client - ): MaybeAsync; - - abstract callContractStatic( - input: Input_callContractStatic, - client: Client - ): MaybeAsync; - - abstract getBalance( - input: Input_getBalance, - client: Client - ): MaybeAsync; - - abstract encodeParams( - input: Input_encodeParams, - client: Client - ): MaybeAsync; - - abstract encodeFunction( - input: Input_encodeFunction, - client: Client - ): MaybeAsync; - - abstract solidityPack( - input: Input_solidityPack, - client: Client - ): MaybeAsync; - - abstract solidityKeccak256( - input: Input_solidityKeccak256, - client: Client - ): MaybeAsync; - - abstract soliditySha256( - input: Input_soliditySha256, - client: Client - ): MaybeAsync; - - abstract getSignerAddress( - input: Input_getSignerAddress, - client: Client - ): MaybeAsync; - - abstract getSignerBalance( - input: Input_getSignerBalance, - client: Client - ): MaybeAsync; - - abstract getSignerTransactionCount( - input: Input_getSignerTransactionCount, - client: Client - ): MaybeAsync; - - abstract getGasPrice( - input: Input_getGasPrice, - client: Client - ): MaybeAsync; - - abstract estimateTransactionGas( - input: Input_estimateTransactionGas, - client: Client - ): MaybeAsync; - - abstract estimateContractCallGas( - input: Input_estimateContractCallGas, - client: Client - ): MaybeAsync; - - abstract checkAddress( - input: Input_checkAddress, - client: Client - ): MaybeAsync; - - abstract toWei( - input: Input_toWei, - client: Client - ): MaybeAsync; - - abstract toEth( - input: Input_toEth, - client: Client - ): MaybeAsync; - - abstract awaitTransaction( - input: Input_awaitTransaction, - client: Client - ): MaybeAsync; - - abstract waitForEvent( - input: Input_waitForEvent, - client: Client - ): MaybeAsync; - - abstract getNetwork( - input: Input_getNetwork, - client: Client - ): MaybeAsync; - - abstract callContractMethod( - input: Input_callContractMethod, - client: Client - ): MaybeAsync; - - abstract callContractMethodAndWait( - input: Input_callContractMethodAndWait, - client: Client - ): MaybeAsync; - - abstract sendTransaction( - input: Input_sendTransaction, - client: Client - ): MaybeAsync; - - abstract sendTransactionAndWait( - input: Input_sendTransactionAndWait, - client: Client - ): MaybeAsync; - - abstract deployContract( - input: Input_deployContract, - client: Client - ): MaybeAsync; - - abstract signMessage( - input: Input_signMessage, - client: Client - ): MaybeAsync; - - abstract sendRPC( - input: Input_sendRPC, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/ethereum/src/w3/schema.ts b/packages/js/plugins/ethereum/src/w3/schema.ts deleted file mode 100644 index 39f2c7278c..0000000000 --- a/packages/js/plugins/ethereum/src/w3/schema.ts +++ /dev/null @@ -1,305 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `### Web3API 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 - -### Web3API Header END ### - -type Module { - callContractView( - address: String! - method: String! - args: [String!] - connection: Connection - ): String! - - callContractStatic( - address: String! - method: String! - args: [String!] - connection: Connection - txOverrides: TxOverrides - ): StaticTxResult! - - getBalance( - address: String! - blockTag: BigInt - connection: 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: Connection - ): String! - - getSignerBalance( - blockTag: BigInt - connection: Connection - ): BigInt! - - getSignerTransactionCount( - blockTag: BigInt - connection: Connection - ): BigInt! - - getGasPrice( - connection: Connection - ): BigInt! - - estimateTransactionGas( - tx: TxRequest! - connection: Connection - ): BigInt! - - estimateContractCallGas( - address: String! - method: String! - args: [String!] - connection: Connection - txOverrides: TxOverrides - ): BigInt! - - checkAddress( - address: String! - ): Boolean! - - toWei( - eth: String! - ): BigInt! - - toEth( - wei: BigInt! - ): String! - - awaitTransaction( - txHash: String! - confirmations: UInt32! - timeout: UInt32! - connection: Connection - ): TxReceipt! - - waitForEvent( - address: String! - event: String! - args: [String!] - timeout: UInt32 - connection: Connection - ): EventNotification! - - getNetwork( - connection: Connection - ): Network! - - callContractMethod( - address: String! - method: String! - args: [String!] - connection: Connection - txOverrides: TxOverrides - ): TxResponse! - - callContractMethodAndWait( - address: String! - method: String! - args: [String!] - connection: Connection - txOverrides: TxOverrides - ): TxReceipt! - - sendTransaction( - tx: TxRequest! - connection: Connection - ): TxResponse! - - sendTransactionAndWait( - tx: TxRequest! - connection: Connection - ): TxReceipt! - - deployContract( - abi: String! - bytecode: String! - args: [String!] - connection: Connection - ): String! - - signMessage( - message: String! - connection: Connection - ): String! - - sendRPC( - method: String! - params: [String!]! - connection: Connection - ): String -} - -type Env { - connection: Connection -} - -type TxReceipt { - to: String! - from: String! - contractAddress: String! - transactionIndex: UInt32! - root: String - gasUsed: BigInt! - logsBloom: String! - transactionHash: String! - logs: [Log!]! - blockNumber: BigInt! - blockHash: String! - confirmations: UInt32! - cumulativeGasUsed: BigInt! - effectiveGasPrice: BigInt! - byzantium: Boolean! - type: UInt32! - status: UInt32 -} - -type 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: [Access!] -} - -type TxRequest { - to: String - from: String - nonce: UInt32 - gasLimit: BigInt - gasPrice: BigInt - data: String - value: BigInt - chainId: BigInt - type: UInt32 -} - -type TxOverrides { - gasLimit: BigInt - gasPrice: BigInt - value: BigInt -} - -type StaticTxResult { - result: String! - error: Boolean! -} - -type Log { - blockNumber: BigInt! - blockHash: String! - transactionIndex: UInt32! - removed: Boolean! - address: String! - data: String! - topics: [String!]! - transactionHash: String! - logIndex: UInt32! -} - -type EventNotification { - data: String! - address: String! - log: Log! -} - -type Access { - address: String! - storageKeys: [String!]! -} - -type Connection { - node: String - networkNameOrChainId: String -} - -type Network { - name: String! - chainId: BigInt! - ensAddress: String -} - -### Imported Modules START ### - -### Imported Modules END ### - -### Imported Objects START ### - -### Imported Objects END ### -`; diff --git a/packages/js/plugins/ethereum/src/w3/types.ts b/packages/js/plugins/ethereum/src/w3/types.ts deleted file mode 100644 index 69e479c8ad..0000000000 --- a/packages/js/plugins/ethereum/src/w3/types.ts +++ /dev/null @@ -1,145 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -// @ts-ignore -import * as Types from "./"; - -// @ts-ignore -import { - Client, - InvokeApiResult -} from "@web3api/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 = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -export interface Env extends Record { - connection?: Types.Connection | null; -} -/// Envs 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/filesystem/src/w3/index.ts b/packages/js/plugins/filesystem/src/w3/index.ts deleted file mode 100644 index ff371c0cd8..0000000000 --- a/packages/js/plugins/filesystem/src/w3/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@web3api/core-js"; diff --git a/packages/js/plugins/filesystem/src/w3/manifest.ts b/packages/js/plugins/filesystem/src/w3/manifest.ts deleted file mode 100644 index de0f50a4ec..0000000000 --- a/packages/js/plugins/filesystem/src/w3/manifest.ts +++ /dev/null @@ -1,16 +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 "@web3api/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - new Uri("ens/uri-resolver.core.web3api.eth"), - ], -}; diff --git a/packages/js/plugins/filesystem/src/w3/module.ts b/packages/js/plugins/filesystem/src/w3/module.ts deleted file mode 100644 index 849fe3d8ed..0000000000 --- a/packages/js/plugins/filesystem/src/w3/module.ts +++ /dev/null @@ -1,36 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -import * as Types from "./types"; - -import { - Client, - PluginModule, - MaybeAsync -} from "@web3api/core-js"; - -export interface Input_tryResolveUri extends Record { - authority: Types.String; - path: Types.String; -} - -export interface Input_getFile extends Record { - path: Types.String; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule< - TConfig -> { - - abstract tryResolveUri( - input: Input_tryResolveUri, - client: Client - ): MaybeAsync; - - abstract getFile( - input: Input_getFile, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/filesystem/src/w3/schema.ts b/packages/js/plugins/filesystem/src/w3/schema.ts deleted file mode 100644 index 5acea6d3d6..0000000000 --- a/packages/js/plugins/filesystem/src/w3/schema.ts +++ /dev/null @@ -1,88 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `### Web3API 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 - -### Web3API Header END ### - -type Module implements UriResolver_Module @imports( - types: [ - "UriResolver_Module", - "UriResolver_MaybeUriOrManifest" - ] -) { - tryResolveUri( - authority: String! - path: String! - ): UriResolver_MaybeUriOrManifest - - getFile( - path: String! - ): Bytes -} - -### Imported Modules START ### - -type UriResolver_Module @imported( - uri: "ens/uri-resolver.core.web3api.eth", - namespace: "UriResolver", - nativeType: "Module" -) { - tryResolveUri( - authority: String! - path: String! - ): UriResolver_MaybeUriOrManifest - - getFile( - path: String! - ): Bytes -} - -### Imported Modules END ### - -### Imported Objects START ### - -type UriResolver_MaybeUriOrManifest @imported( - uri: "ens/uri-resolver.core.web3api.eth", - namespace: "UriResolver", - nativeType: "MaybeUriOrManifest" -) { - uri: String - manifest: String -} - -### Imported Objects END ### -`; diff --git a/packages/js/plugins/filesystem/src/w3/types.ts b/packages/js/plugins/filesystem/src/w3/types.ts deleted file mode 100644 index 9417db1f5a..0000000000 --- a/packages/js/plugins/filesystem/src/w3/types.ts +++ /dev/null @@ -1,85 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -// @ts-ignore -import * as Types from "./"; - -// @ts-ignore -import { - Client, - InvokeApiResult -} from "@web3api/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 = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -/// Envs END /// - -/// Objects START /// -/// Objects END /// - -/// Enums START /// -/// Enums END /// - -/// Imported Objects START /// - -/* URI: "ens/uri-resolver.core.web3api.eth" */ -export interface UriResolver_MaybeUriOrManifest { - uri?: Types.String | null; - manifest?: Types.String | null; -} - -/// Imported Objects END /// - -/// Imported Modules START /// - -/* URI: "ens/uri-resolver.core.web3api.eth" */ -interface UriResolver_Module_Input_tryResolveUri extends Record { - authority: Types.String; - path: Types.String; -} - -/* URI: "ens/uri-resolver.core.web3api.eth" */ -interface UriResolver_Module_Input_getFile extends Record { - path: Types.String; -} - -/* URI: "ens/uri-resolver.core.web3api.eth" */ -export const UriResolver_Module = { - tryResolveUri: async ( - input: UriResolver_Module_Input_tryResolveUri, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/uri-resolver.core.web3api.eth", - method: "tryResolveUri", - input - }); - }, - - getFile: async ( - input: UriResolver_Module_Input_getFile, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/uri-resolver.core.web3api.eth", - method: "getFile", - input - }); - } -} - -/// Imported Modules END /// diff --git a/packages/js/plugins/graph-node/src/w3/index.ts b/packages/js/plugins/graph-node/src/w3/index.ts deleted file mode 100644 index ff371c0cd8..0000000000 --- a/packages/js/plugins/graph-node/src/w3/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@web3api/core-js"; diff --git a/packages/js/plugins/graph-node/src/w3/manifest.ts b/packages/js/plugins/graph-node/src/w3/manifest.ts deleted file mode 100644 index 4d35c2182f..0000000000 --- a/packages/js/plugins/graph-node/src/w3/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 "@web3api/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - ], -}; diff --git a/packages/js/plugins/graph-node/src/w3/module.ts b/packages/js/plugins/graph-node/src/w3/module.ts deleted file mode 100644 index fc82f0e84f..0000000000 --- a/packages/js/plugins/graph-node/src/w3/module.ts +++ /dev/null @@ -1,28 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -import * as Types from "./types"; - -import { - Client, - PluginModule, - MaybeAsync -} from "@web3api/core-js"; - -export interface Input_querySubgraph extends Record { - subgraphAuthor: Types.String; - subgraphName: Types.String; - query: Types.String; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule< - TConfig -> { - - abstract querySubgraph( - input: Input_querySubgraph, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/graph-node/src/w3/schema.ts b/packages/js/plugins/graph-node/src/w3/schema.ts deleted file mode 100644 index 11cef53098..0000000000 --- a/packages/js/plugins/graph-node/src/w3/schema.ts +++ /dev/null @@ -1,130 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `### Web3API 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 - -### Web3API Header END ### - -type Module @imports( - types: [ - "HTTP_Module", - "HTTP_Request", - "HTTP_Header", - "HTTP_UrlParam", - "HTTP_ResponseType", - "HTTP_Response" - ] -) { - querySubgraph( - subgraphAuthor: String! - subgraphName: String! - query: String! - ): String! -} - -### Imported Modules START ### - -type HTTP_Module @imported( - uri: "ens/http.web3api.eth", - namespace: "HTTP", - nativeType: "Module" -) { - get( - url: String! - request: HTTP_Request - ): HTTP_Response - - post( - url: String! - request: HTTP_Request - ): HTTP_Response -} - -### Imported Modules END ### - -### Imported Objects START ### - -type HTTP_Request @imported( - uri: "ens/http.web3api.eth", - namespace: "HTTP", - nativeType: "Request" -) { - headers: [HTTP_Header!] - urlParams: [HTTP_UrlParam!] - responseType: HTTP_ResponseType! - body: String -} - -type HTTP_Header @imported( - uri: "ens/http.web3api.eth", - namespace: "HTTP", - nativeType: "Header" -) { - key: String! - value: String! -} - -type HTTP_UrlParam @imported( - uri: "ens/http.web3api.eth", - namespace: "HTTP", - nativeType: "UrlParam" -) { - key: String! - value: String! -} - -type HTTP_Response @imported( - uri: "ens/http.web3api.eth", - namespace: "HTTP", - nativeType: "Response" -) { - status: Int! - statusText: String! - headers: [HTTP_Header!] - body: String -} - -enum HTTP_ResponseType @imported( - uri: "ens/http.web3api.eth", - namespace: "HTTP", - nativeType: "ResponseType" -) { - TEXT - BINARY -} - -### Imported Objects END ### -`; diff --git a/packages/js/plugins/graph-node/src/w3/types.ts b/packages/js/plugins/graph-node/src/w3/types.ts deleted file mode 100644 index 1bab3bd6e3..0000000000 --- a/packages/js/plugins/graph-node/src/w3/types.ts +++ /dev/null @@ -1,120 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -// @ts-ignore -import * as Types from "./"; - -// @ts-ignore -import { - Client, - InvokeApiResult -} from "@web3api/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 = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -/// Envs END /// - -/// Objects START /// -/// Objects END /// - -/// Enums START /// -/// Enums END /// - -/// Imported Objects START /// - -/* URI: "ens/http.web3api.eth" */ -export interface HTTP_Request { - headers?: Array | null; - urlParams?: Array | null; - responseType: Types.HTTP_ResponseType; - body?: Types.String | null; -} - -/* URI: "ens/http.web3api.eth" */ -export interface HTTP_Header { - key: Types.String; - value: Types.String; -} - -/* URI: "ens/http.web3api.eth" */ -export interface HTTP_UrlParam { - key: Types.String; - value: Types.String; -} - -/* URI: "ens/http.web3api.eth" */ -export interface HTTP_Response { - status: Types.Int; - statusText: Types.String; - headers?: Array | null; - body?: Types.String | null; -} - -/* URI: "ens/http.web3api.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.web3api.eth" */ -interface HTTP_Module_Input_get extends Record { - url: Types.String; - request?: Types.HTTP_Request | null; -} - -/* URI: "ens/http.web3api.eth" */ -interface HTTP_Module_Input_post extends Record { - url: Types.String; - request?: Types.HTTP_Request | null; -} - -/* URI: "ens/http.web3api.eth" */ -export const HTTP_Module = { - get: async ( - input: HTTP_Module_Input_get, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/http.web3api.eth", - method: "get", - input - }); - }, - - post: async ( - input: HTTP_Module_Input_post, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/http.web3api.eth", - method: "post", - input - }); - } -} - -/// Imported Modules END /// diff --git a/packages/js/plugins/http/src/w3/index.ts b/packages/js/plugins/http/src/w3/index.ts deleted file mode 100644 index ff371c0cd8..0000000000 --- a/packages/js/plugins/http/src/w3/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@web3api/core-js"; diff --git a/packages/js/plugins/http/src/w3/manifest.ts b/packages/js/plugins/http/src/w3/manifest.ts deleted file mode 100644 index 4d35c2182f..0000000000 --- a/packages/js/plugins/http/src/w3/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 "@web3api/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - ], -}; diff --git a/packages/js/plugins/http/src/w3/module.ts b/packages/js/plugins/http/src/w3/module.ts deleted file mode 100644 index 4c464be7cd..0000000000 --- a/packages/js/plugins/http/src/w3/module.ts +++ /dev/null @@ -1,37 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -import * as Types from "./types"; - -import { - Client, - PluginModule, - MaybeAsync -} from "@web3api/core-js"; - -export interface Input_get extends Record { - url: Types.String; - request?: Types.Request | null; -} - -export interface Input_post extends Record { - url: Types.String; - request?: Types.Request | null; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule< - TConfig -> { - - abstract get( - input: Input_get, - client: Client - ): MaybeAsync; - - abstract post( - input: Input_post, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/http/src/w3/schema.ts b/packages/js/plugins/http/src/w3/schema.ts deleted file mode 100644 index 7f372b978d..0000000000 --- a/packages/js/plugins/http/src/w3/schema.ts +++ /dev/null @@ -1,89 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `### Web3API 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 - -### Web3API Header END ### - -type Module { - get( - url: String! - request: Request - ): Response - - post( - url: String! - request: Request - ): Response -} - -type Header { - key: String! - value: String! -} - -type UrlParam { - key: String! - value: String! -} - -type Response { - status: Int! - statusText: String! - headers: [Header!] - body: String -} - -type Request { - headers: [Header!] - urlParams: [UrlParam!] - responseType: ResponseType! - body: String -} - -enum ResponseType { - TEXT - BINARY -} - -### Imported Modules START ### - -### Imported Modules END ### - -### Imported Objects START ### - -### Imported Objects END ### -`; diff --git a/packages/js/plugins/http/src/w3/types.ts b/packages/js/plugins/http/src/w3/types.ts deleted file mode 100644 index 24f70ee82b..0000000000 --- a/packages/js/plugins/http/src/w3/types.ts +++ /dev/null @@ -1,78 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -// @ts-ignore -import * as Types from "./"; - -// @ts-ignore -import { - Client, - InvokeApiResult -} from "@web3api/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 = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -/// Envs END /// - -/// Objects START /// -export interface Header { - key: Types.String; - value: Types.String; -} - -export interface UrlParam { - key: Types.String; - value: Types.String; -} - -export interface Response { - status: Types.Int; - statusText: Types.String; - headers?: Array | null; - body?: Types.String | null; -} - -export interface Request { - headers?: Array | null; - urlParams?: Array | 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/ipfs/src/w3/index.ts b/packages/js/plugins/ipfs/src/w3/index.ts deleted file mode 100644 index ff371c0cd8..0000000000 --- a/packages/js/plugins/ipfs/src/w3/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@web3api/core-js"; diff --git a/packages/js/plugins/ipfs/src/w3/manifest.ts b/packages/js/plugins/ipfs/src/w3/manifest.ts deleted file mode 100644 index de0f50a4ec..0000000000 --- a/packages/js/plugins/ipfs/src/w3/manifest.ts +++ /dev/null @@ -1,16 +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 "@web3api/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - new Uri("ens/uri-resolver.core.web3api.eth"), - ], -}; diff --git a/packages/js/plugins/ipfs/src/w3/module.ts b/packages/js/plugins/ipfs/src/w3/module.ts deleted file mode 100644 index b4bbd4ce0a..0000000000 --- a/packages/js/plugins/ipfs/src/w3/module.ts +++ /dev/null @@ -1,66 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -import * as Types from "./types"; - -import { - Client, - PluginModule, - MaybeAsync -} from "@web3api/core-js"; - -export interface Input_catFile extends Record { - cid: Types.String; - options?: Types.Options | null; -} - -export interface Input_resolve extends Record { - cid: Types.String; - options?: Types.Options | null; -} - -export interface Input_addFile extends Record { - data: Types.Bytes; -} - -export interface Input_tryResolveUri extends Record { - authority: Types.String; - path: Types.String; -} - -export interface Input_getFile extends Record { - path: Types.String; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule< - TConfig, - Types.Env -> { - - abstract catFile( - input: Input_catFile, - client: Client - ): MaybeAsync; - - abstract resolve( - input: Input_resolve, - client: Client - ): MaybeAsync; - - abstract addFile( - input: Input_addFile, - client: Client - ): MaybeAsync; - - abstract tryResolveUri( - input: Input_tryResolveUri, - client: Client - ): MaybeAsync; - - abstract getFile( - input: Input_getFile, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/ipfs/src/w3/schema.ts b/packages/js/plugins/ipfs/src/w3/schema.ts deleted file mode 100644 index 1585e9f339..0000000000 --- a/packages/js/plugins/ipfs/src/w3/schema.ts +++ /dev/null @@ -1,130 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `### Web3API 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 - -### Web3API Header END ### - -type Module implements UriResolver_Module @imports( - types: [ - "UriResolver_Module", - "UriResolver_MaybeUriOrManifest" - ] -) { - catFile( - cid: String! - options: Options - ): Bytes! - - resolve( - cid: String! - options: Options - ): ResolveResult - - addFile( - data: Bytes! - ): String! - - tryResolveUri( - authority: String! - path: String! - ): UriResolver_MaybeUriOrManifest - - getFile( - path: String! - ): Bytes -} - -type Env { - """ - Disable querying providers in parallel when resolving URIs - """ - disableParallelRequests: Boolean -} - -type ResolveResult { - cid: String! - provider: String! -} - -type 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 Modules START ### - -type UriResolver_Module @imported( - uri: "ens/uri-resolver.core.web3api.eth", - namespace: "UriResolver", - nativeType: "Module" -) { - tryResolveUri( - authority: String! - path: String! - ): UriResolver_MaybeUriOrManifest - - getFile( - path: String! - ): Bytes -} - -### Imported Modules END ### - -### Imported Objects START ### - -type UriResolver_MaybeUriOrManifest @imported( - uri: "ens/uri-resolver.core.web3api.eth", - namespace: "UriResolver", - nativeType: "MaybeUriOrManifest" -) { - uri: String - manifest: String -} - -### Imported Objects END ### -`; diff --git a/packages/js/plugins/ipfs/src/w3/types.ts b/packages/js/plugins/ipfs/src/w3/types.ts deleted file mode 100644 index 9623616af5..0000000000 --- a/packages/js/plugins/ipfs/src/w3/types.ts +++ /dev/null @@ -1,99 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -// @ts-ignore -import * as Types from "./"; - -// @ts-ignore -import { - Client, - InvokeApiResult -} from "@web3api/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 = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -export interface Env extends Record { - disableParallelRequests?: Types.Boolean | null; -} -/// Envs END /// - -/// Objects START /// -export interface ResolveResult { - cid: Types.String; - provider: Types.String; -} - -export interface Options { - timeout?: Types.UInt32 | null; - provider?: Types.String | null; - disableParallelRequests?: Types.Boolean | null; -} - -/// Objects END /// - -/// Enums START /// -/// Enums END /// - -/// Imported Objects START /// - -/* URI: "ens/uri-resolver.core.web3api.eth" */ -export interface UriResolver_MaybeUriOrManifest { - uri?: Types.String | null; - manifest?: Types.String | null; -} - -/// Imported Objects END /// - -/// Imported Modules START /// - -/* URI: "ens/uri-resolver.core.web3api.eth" */ -interface UriResolver_Module_Input_tryResolveUri extends Record { - authority: Types.String; - path: Types.String; -} - -/* URI: "ens/uri-resolver.core.web3api.eth" */ -interface UriResolver_Module_Input_getFile extends Record { - path: Types.String; -} - -/* URI: "ens/uri-resolver.core.web3api.eth" */ -export const UriResolver_Module = { - tryResolveUri: async ( - input: UriResolver_Module_Input_tryResolveUri, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/uri-resolver.core.web3api.eth", - method: "tryResolveUri", - input - }); - }, - - getFile: async ( - input: UriResolver_Module_Input_getFile, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/uri-resolver.core.web3api.eth", - method: "getFile", - input - }); - } -} - -/// Imported Modules END /// diff --git a/packages/js/plugins/logger/src/w3/index.ts b/packages/js/plugins/logger/src/w3/index.ts deleted file mode 100644 index ff371c0cd8..0000000000 --- a/packages/js/plugins/logger/src/w3/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@web3api/core-js"; diff --git a/packages/js/plugins/logger/src/w3/manifest.ts b/packages/js/plugins/logger/src/w3/manifest.ts deleted file mode 100644 index 89f52903da..0000000000 --- a/packages/js/plugins/logger/src/w3/manifest.ts +++ /dev/null @@ -1,16 +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 "@web3api/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - new Uri("ens/logger.core.web3api.eth"), - ], -}; diff --git a/packages/js/plugins/logger/src/w3/module.ts b/packages/js/plugins/logger/src/w3/module.ts deleted file mode 100644 index 740e21c9f3..0000000000 --- a/packages/js/plugins/logger/src/w3/module.ts +++ /dev/null @@ -1,27 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -import * as Types from "./types"; - -import { - Client, - PluginModule, - MaybeAsync -} from "@web3api/core-js"; - -export interface Input_log extends Record { - level: Types.Logger_LogLevel; - message: Types.String; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule< - TConfig -> { - - abstract log( - input: Input_log, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/logger/src/w3/schema.ts b/packages/js/plugins/logger/src/w3/schema.ts deleted file mode 100644 index 64bb6537f8..0000000000 --- a/packages/js/plugins/logger/src/w3/schema.ts +++ /dev/null @@ -1,82 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `### Web3API 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 - -### Web3API Header END ### - -type Module implements Logger_Module @imports( - types: [ - "Logger_Module", - "Logger_LogLevel" - ] -) { - log( - level: Logger_LogLevel! - message: String! - ): Boolean! -} - -### Imported Modules START ### - -type Logger_Module @imported( - uri: "ens/logger.core.web3api.eth", - namespace: "Logger", - nativeType: "Module" -) { - log( - level: Logger_LogLevel! - message: String! - ): Boolean! -} - -### Imported Modules END ### - -### Imported Objects START ### - -enum Logger_LogLevel @imported( - uri: "ens/logger.core.web3api.eth", - namespace: "Logger", - nativeType: "LogLevel" -) { - DEBUG - INFO - WARN - ERROR -} - -### Imported Objects END ### -`; diff --git a/packages/js/plugins/logger/src/w3/types.ts b/packages/js/plugins/logger/src/w3/types.ts deleted file mode 100644 index 13e52a0da9..0000000000 --- a/packages/js/plugins/logger/src/w3/types.ts +++ /dev/null @@ -1,79 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -// @ts-ignore -import * as Types from "./"; - -// @ts-ignore -import { - Client, - InvokeApiResult -} from "@web3api/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 = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -/// Envs END /// - -/// Objects START /// -/// Objects END /// - -/// Enums START /// -/// Enums END /// - -/// Imported Objects START /// - -/* URI: "ens/logger.core.web3api.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.web3api.eth" */ -interface Logger_Module_Input_log extends Record { - level: Types.Logger_LogLevel; - message: Types.String; -} - -/* URI: "ens/logger.core.web3api.eth" */ -export const Logger_Module = { - log: async ( - input: Logger_Module_Input_log, - client: Client - ): Promise> => { - return client.invoke({ - uri: "ens/logger.core.web3api.eth", - method: "log", - input - }); - } -} - -/// Imported Modules END /// diff --git a/packages/js/plugins/sha3/src/w3/index.ts b/packages/js/plugins/sha3/src/w3/index.ts deleted file mode 100644 index ff371c0cd8..0000000000 --- a/packages/js/plugins/sha3/src/w3/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@web3api/core-js"; diff --git a/packages/js/plugins/sha3/src/w3/manifest.ts b/packages/js/plugins/sha3/src/w3/manifest.ts deleted file mode 100644 index 4d35c2182f..0000000000 --- a/packages/js/plugins/sha3/src/w3/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 "@web3api/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - ], -}; diff --git a/packages/js/plugins/sha3/src/w3/module.ts b/packages/js/plugins/sha3/src/w3/module.ts deleted file mode 100644 index 569153b9d1..0000000000 --- a/packages/js/plugins/sha3/src/w3/module.ts +++ /dev/null @@ -1,127 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -import * as Types from "./types"; - -import { - Client, - PluginModule, - MaybeAsync -} from "@web3api/core-js"; - -export interface Input_sha3_512 extends Record { - message: Types.String; -} - -export interface Input_sha3_384 extends Record { - message: Types.String; -} - -export interface Input_sha3_256 extends Record { - message: Types.String; -} - -export interface Input_sha3_224 extends Record { - message: Types.String; -} - -export interface Input_keccak_512 extends Record { - message: Types.String; -} - -export interface Input_keccak_384 extends Record { - message: Types.String; -} - -export interface Input_keccak_256 extends Record { - message: Types.String; -} - -export interface Input_keccak_224 extends Record { - message: Types.String; -} - -export interface Input_hex_keccak_256 extends Record { - message: Types.String; -} - -export interface Input_buffer_keccak_256 extends Record { - message: Types.Bytes; -} - -export interface Input_shake_128 extends Record { - message: Types.String; - outputBits: Types.Int; -} - -export interface Input_shake_256 extends Record { - message: Types.String; - outputBits: Types.Int; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule< - TConfig -> { - - abstract sha3_512( - input: Input_sha3_512, - client: Client - ): MaybeAsync; - - abstract sha3_384( - input: Input_sha3_384, - client: Client - ): MaybeAsync; - - abstract sha3_256( - input: Input_sha3_256, - client: Client - ): MaybeAsync; - - abstract sha3_224( - input: Input_sha3_224, - client: Client - ): MaybeAsync; - - abstract keccak_512( - input: Input_keccak_512, - client: Client - ): MaybeAsync; - - abstract keccak_384( - input: Input_keccak_384, - client: Client - ): MaybeAsync; - - abstract keccak_256( - input: Input_keccak_256, - client: Client - ): MaybeAsync; - - abstract keccak_224( - input: Input_keccak_224, - client: Client - ): MaybeAsync; - - abstract hex_keccak_256( - input: Input_hex_keccak_256, - client: Client - ): MaybeAsync; - - abstract buffer_keccak_256( - input: Input_buffer_keccak_256, - client: Client - ): MaybeAsync; - - abstract shake_128( - input: Input_shake_128, - client: Client - ): MaybeAsync; - - abstract shake_256( - input: Input_shake_256, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/sha3/src/w3/schema.ts b/packages/js/plugins/sha3/src/w3/schema.ts deleted file mode 100644 index 52c6d3adc5..0000000000 --- a/packages/js/plugins/sha3/src/w3/schema.ts +++ /dev/null @@ -1,100 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `### Web3API 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 - -### Web3API Header END ### - -type Module { - sha3_512( - message: String! - ): String! - - sha3_384( - message: String! - ): String! - - sha3_256( - message: String! - ): String! - - sha3_224( - message: String! - ): String! - - keccak_512( - message: String! - ): String! - - keccak_384( - message: String! - ): String! - - keccak_256( - message: String! - ): String! - - keccak_224( - message: String! - ): String! - - hex_keccak_256( - message: String! - ): String! - - buffer_keccak_256( - message: Bytes! - ): String! - - shake_128( - message: String! - outputBits: Int! - ): String! - - shake_256( - message: String! - outputBits: Int! - ): String! -} - -### Imported Modules START ### - -### Imported Modules END ### - -### Imported Objects START ### - -### Imported Objects END ### -`; diff --git a/packages/js/plugins/sha3/src/w3/types.ts b/packages/js/plugins/sha3/src/w3/types.ts deleted file mode 100644 index a2bf8c1774..0000000000 --- a/packages/js/plugins/sha3/src/w3/types.ts +++ /dev/null @@ -1,43 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -// @ts-ignore -import * as Types from "./"; - -// @ts-ignore -import { - Client, - InvokeApiResult -} from "@web3api/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 = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -/// Envs 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/uts46/src/w3/index.ts b/packages/js/plugins/uts46/src/w3/index.ts deleted file mode 100644 index ff371c0cd8..0000000000 --- a/packages/js/plugins/uts46/src/w3/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export * from "./schema"; -export * from "./manifest"; -export * from "./module"; -export * from "./types"; - -export { Client } from "@web3api/core-js"; diff --git a/packages/js/plugins/uts46/src/w3/manifest.ts b/packages/js/plugins/uts46/src/w3/manifest.ts deleted file mode 100644 index 4d35c2182f..0000000000 --- a/packages/js/plugins/uts46/src/w3/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 "@web3api/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - ], -}; diff --git a/packages/js/plugins/uts46/src/w3/module.ts b/packages/js/plugins/uts46/src/w3/module.ts deleted file mode 100644 index ebd5206928..0000000000 --- a/packages/js/plugins/uts46/src/w3/module.ts +++ /dev/null @@ -1,44 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -import * as Types from "./types"; - -import { - Client, - PluginModule, - MaybeAsync -} from "@web3api/core-js"; - -export interface Input_toAscii extends Record { - value: Types.String; -} - -export interface Input_toUnicode extends Record { - value: Types.String; -} - -export interface Input_convert extends Record { - value: Types.String; -} - -export abstract class Module< - TConfig extends Record -> extends PluginModule< - TConfig -> { - - abstract toAscii( - input: Input_toAscii, - client: Client - ): MaybeAsync; - - abstract toUnicode( - input: Input_toUnicode, - client: Client - ): MaybeAsync; - - abstract convert( - input: Input_convert, - client: Client - ): MaybeAsync; -} diff --git a/packages/js/plugins/uts46/src/w3/schema.ts b/packages/js/plugins/uts46/src/w3/schema.ts deleted file mode 100644 index f6fef2ed55..0000000000 --- a/packages/js/plugins/uts46/src/w3/schema.ts +++ /dev/null @@ -1,67 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `### Web3API 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 - -### Web3API Header END ### - -type Module { - toAscii( - value: String! - ): String! - - toUnicode( - value: String! - ): String! - - convert( - value: String! - ): ConvertResult! -} - -type ConvertResult { - IDN: String! - PC: String! -} - -### Imported Modules START ### - -### Imported Modules END ### - -### Imported Objects START ### - -### Imported Objects END ### -`; diff --git a/packages/js/plugins/uts46/src/w3/types.ts b/packages/js/plugins/uts46/src/w3/types.ts deleted file mode 100644 index 0d352b8b2d..0000000000 --- a/packages/js/plugins/uts46/src/w3/types.ts +++ /dev/null @@ -1,48 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -// @ts-ignore -import * as Types from "./"; - -// @ts-ignore -import { - Client, - InvokeApiResult -} from "@web3api/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 = ArrayBuffer; -export type BigInt = string; -export type BigNumber = string; -export type Json = string; -export type String = string; -export type Boolean = boolean; - -/// Envs START /// -/// Envs 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 /// From ea2b462ea87bebdc4d28a848025ff6d61ccf551b Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Mon, 20 Jun 2022 12:13:02 +0400 Subject: [PATCH 15/38] chore: update yarn.lock --- yarn.lock | 76 +++++++++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/yarn.lock b/yarn.lock index 57019aadd2..8da8eb0bc5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1384,9 +1384,9 @@ strip-json-comments "^3.1.1" "@ethersproject/abi@^5.0.0", "@ethersproject/abi@^5.6.3": - version "5.6.3" - resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.6.3.tgz#2d643544abadf6e6b63150508af43475985c23db" - integrity sha512-CxKTdoZY4zDJLWXG6HzNH6znWK0M79WzzxHegDoecE3+K32pzfHOzuXg2/oGSTecZynFgpkjYXNPOqXVJlqClw== + version "5.6.4" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.6.4.tgz#f6e01b6ed391a505932698ecc0d9e7a99ee60362" + integrity sha512-TTeZUlCeIHG6527/2goZA6gW5F8Emoc7MrZDC7hhP84aRGvW3TEdTnZR08Ls88YXM1m2SuK42Osw/jSi3uO8gg== dependencies: "@ethersproject/address" "^5.6.1" "@ethersproject/bignumber" "^5.6.2" @@ -1571,9 +1571,9 @@ integrity sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg== "@ethersproject/networks@^5.0.0", "@ethersproject/networks@^5.0.3", "@ethersproject/networks@^5.6.3": - version "5.6.3" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.6.3.tgz#3ee3ab08f315b433b50c99702eb32e0cf31f899f" - integrity sha512-QZxRH7cA5Ut9TbXwZFiCyuPchdWi87ZtVNHWZd0R6YFgYtes2jQ3+bsslJ0WdyDe0i6QumqtoYqvY3rrQFRZOQ== + version "5.6.4" + resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.6.4.tgz#51296d8fec59e9627554f5a8a9c7791248c8dc07" + integrity sha512-KShHeHPahHI2UlWdtDMn2lJETcbtaJge4k7XSjDR9h79QTd6yQJmv6Cp2ZA4JdqWnhszAOLSuJEd9C0PRw7hSQ== dependencies: "@ethersproject/logger" "^5.6.0" @@ -3472,14 +3472,14 @@ integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== "@tsconfig/node12@^1.0.7": - version "1.0.10" - resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.10.tgz#10fecee4a3be17357ce99b370bd81874044d8dbd" - integrity sha512-N+srakvPaYMGkwjNDx3ASx65Zl3QG8dJgVtIB+YMOkucU+zctlv/hdP5250VKdDHSDoW9PFZoCqbqNcAPjCjXA== + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" + integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== "@tsconfig/node14@^1.0.0": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.2.tgz#b09c08de2eb319ca2acab17a1b8028af110b24b3" - integrity sha512-YwrUA5ysDXHFYfL0Xed9x3sNS4P+aKlCOnnbqUa2E5HdQshHFleCJVrj1PlGTb4GgFUCDyte1v3JWLy2sz8Oqg== + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" + integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== "@tsconfig/node16@^1.0.2": version "1.0.3" @@ -3670,9 +3670,9 @@ integrity sha512-wH6Tu9mbiOt0n5EvdoWy0VGQaJMHfLIxY/6wS0xLC7CV1taM6gESEzcYy0ZlWvxxiiljYvfDIvz4hHbUUDRlhw== "@types/node@*": - version "17.0.44" - resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.44.tgz#16dd0bb5338f016d8ca10631789f0d0612fe5d5b" - integrity sha512-gWYiOlu6Y4oyLYBvsJAPlwHbC8H4tX+tLsHy6Ee976wedwwZKrG2hFl3Y/HiH6bIyLTbDWQexQF/ohwKkOpUCg== + version "18.0.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.0.0.tgz#67c7b724e1bcdd7a8821ce0d5ee184d3b4dd525a" + integrity sha512-cHlGmko4gWLVI27cGJntjs/Sj8th9aYwplmZFwmmgYQQvL5NUsgVJG7OddLvNfLqYS31KFN0s3qlaD9qCaxACA== "@types/node@12.12.26": version "12.12.26" @@ -5640,9 +5640,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.30001349: - version "1.0.30001354" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001354.tgz#95c5efdb64148bb4870771749b9a619304755ce5" - integrity sha512-mImKeCkyGDAHNywYFA4bqnLAzTUvVkqPvhY4DV47X+Gl2c5Z8c3KNETnXp14GQt11LvxE8AwjzGxJ+rsikiOzg== + version "1.0.30001357" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001357.tgz#dec7fc4158ef6ad24690d0eec7b91f32b8cb1b5d" + integrity sha512-b+KbWHdHePp+ZpNj+RDHFChZmuN+J5EvuQUlee9jOQIUAdhv9uvAZeEtUeLAknXbkiu1uxjQ9NLp1ie894CuWg== capture-exit@^2.0.0: version "2.0.0" @@ -7320,9 +7320,9 @@ electron-fetch@^1.7.2: encoding "^0.1.13" electron-to-chromium@^1.3.378, electron-to-chromium@^1.4.147: - version "1.4.157" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.157.tgz#25799684ed6f2be52bee2b716f9de257b24f3ba7" - integrity sha512-gteFnXPKsDAdm1U5vVuyrLnKOaR/x/SY+HjUQoHypLUYWJt4RaWU3PaiTBEkRDJh8/Zd8KC/EFjV+uPaHsjKFA== + version "1.4.161" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.161.tgz#49cb5b35385bfee6cc439d0a04fbba7a7a7f08a1" + integrity sha512-sTjBRhqh6wFodzZtc5Iu8/R95OkwaPNn7tj/TaDU5nu/5EFiQDtADGAXdR4tJcTEHlYfJpHqigzJqHvPgehP8A== elliptic@6.5.4, elliptic@^6.5.3: version "6.5.4" @@ -9952,7 +9952,7 @@ is-color-stop@^1.0.0: rgb-regex "^1.0.1" rgba-regex "^1.0.0" -is-core-module@^2.5.0, is-core-module@^2.8.1: +is-core-module@^2.5.0, is-core-module@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== @@ -12547,9 +12547,9 @@ minipass@^2.6.0, minipass@^2.9.0: yallist "^3.0.0" minipass@^3.0.0, minipass@^3.1.0, minipass@^3.1.1, minipass@^3.1.3: - version "3.1.6" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.6.tgz#3b8150aa688a711a1521af5e8779c1d3bb4f45ee" - integrity sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ== + version "3.3.3" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.3.3.tgz#fd1f0e6c06449c10dadda72618b59c00f3d6378d" + integrity sha512-N0BOsdFAlNRfmwMhjAsLVWOk7Ljmeb39iqFlsV1At+jqRhSUP9yeof8FyJu4imaJiSUp8vQebWD/guZwGQC8iA== dependencies: yallist "^4.0.0" @@ -14757,9 +14757,9 @@ prettier@2.2.1: integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== prettier@^2.2.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.0.tgz#a4fdae07e5596c51c9857ea676cd41a0163879d6" - integrity sha512-nwoX4GMFgxoPC6diHvSwmK/4yU8FFH3V8XWtLQrbj4IBsK2pkYhG4kf/ljF/haaZ/aii+wNJqISrCDPgxGWDVQ== + version "2.7.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" + integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== pretty-bytes@^5.1.0: version "5.6.0" @@ -15774,11 +15774,11 @@ resolve@1.15.0: path-parse "^1.0.6" resolve@^1.10.0, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.15.1, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.20.0, resolve@^1.3.2, resolve@^1.8.1: - version "1.22.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" - integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== + version "1.22.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" + integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== dependencies: - is-core-module "^2.8.1" + is-core-module "^2.9.0" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" @@ -17494,14 +17494,14 @@ typescript@4.0.7: integrity sha512-yi7M4y74SWvYbnazbn8/bmJmX4Zlej39ZOqwG/8dut/MYoSQ119GY9ZFbbGsD4PFZYWxqik/XsP3vk3+W5H3og== typescript@^4.0: - version "4.7.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.3.tgz#8364b502d5257b540f9de4c40be84c98e23a129d" - integrity sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA== + version "4.7.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" + integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== uglify-js@^3.1.4: - version "3.16.0" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.16.0.tgz#b778ba0831ca102c1d8ecbdec2d2bdfcc7353190" - integrity sha512-FEikl6bR30n0T3amyBh3LoiBdqHRy/f4H80+My34HOesOKyHfOsxAPAxOoqC0JUnC1amnO0IwkYC3sko51caSw== + version "3.16.1" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.16.1.tgz#0e7ec928b3d0b1e1d952bce634c384fd56377317" + integrity sha512-X5BGTIDH8U6IQ1TIRP62YC36k+ULAa1d59BxlWvPUJ1NkW5L3FwcGfEzuVvGmhJFBu0YJ5Ge25tmRISqCmLiRQ== uid-number@0.0.6: version "0.0.6" From fa13c3678b6d2c971d9bb7838f3d623309ec41a9 Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Mon, 20 Jun 2022 12:55:37 +0400 Subject: [PATCH 16/38] chore: rename web3api to polywrap --- packages/cli/src/commands/run.ts | 6 +++--- packages/cli/src/lib/helpers/workflow-validator.ts | 2 +- packages/cli/src/lib/option-parsers/run.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/commands/run.ts b/packages/cli/src/commands/run.ts index b5f52265f4..1494c66522 100644 --- a/packages/cli/src/commands/run.ts +++ b/packages/cli/src/commands/run.ts @@ -7,8 +7,8 @@ import { validateOutput, } from "../lib"; -import { InvokeResult, Workflow } from "@web3api/core-js"; -import { PolywrapClient, PolywrapClientConfig } from "@web3api/client-js"; +import { InvokeResult, Workflow } from "@polywrap/core-js"; +import { PolywrapClient, PolywrapClientConfig } from "@polywrap/client-js"; import path from "path"; import yaml from "js-yaml"; import fs from "fs"; @@ -85,7 +85,7 @@ const _run = async (workflowPath: string, options: WorkflowCommandOptions) => { workflow, config: clientConfig, ids: jobs, - onExecution: async (id, data, error) => { + onExecution: async (id: string, data: unknown, error: Error) => { if (!quiet) { console.log("-----------------------------------"); console.log(`ID: ${id}`); diff --git a/packages/cli/src/lib/helpers/workflow-validator.ts b/packages/cli/src/lib/helpers/workflow-validator.ts index 4622415c2e..c28b3cdcef 100644 --- a/packages/cli/src/lib/helpers/workflow-validator.ts +++ b/packages/cli/src/lib/helpers/workflow-validator.ts @@ -1,7 +1,7 @@ import { runCommand } from "../system"; import fs from "fs"; -import { InvokeResult } from "@web3api/core-js"; +import { InvokeResult } from "@polywrap/core-js"; const TMPDIR = process.env.TMPDIR || "/tmp"; diff --git a/packages/cli/src/lib/option-parsers/run.ts b/packages/cli/src/lib/option-parsers/run.ts index 322a60667f..873e8e5c92 100644 --- a/packages/cli/src/lib/option-parsers/run.ts +++ b/packages/cli/src/lib/option-parsers/run.ts @@ -5,8 +5,8 @@ import { validateClientConfig } from "../helpers"; import path from "path"; import fs from "fs"; -import { PolywrapClientConfig } from "@web3api/client-js"; -import { executeMaybeAsyncFunction } from "@web3api/core-js"; +import { PolywrapClientConfig } from "@polywrap/client-js"; +import { executeMaybeAsyncFunction } from "@polywrap/core-js"; export function parseWorkflowScriptPathOption( script: string, From a283fbe47a0a7524c54b0703c73a0203248f985c Mon Sep 17 00:00:00 2001 From: cbrzn Date: Mon, 20 Jun 2022 11:40:50 +0200 Subject: [PATCH 17/38] fix: cli test --- packages/cli/lang/en.json | 2 +- packages/cli/lang/es.json | 2 +- packages/cli/src/__tests__/e2e/help.spec.ts | 2 +- .../cli/src/__tests__/e2e/no-command.spec.ts | 2 +- packages/cli/src/__tests__/e2e/run.spec.ts | 36 +++++++++---------- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/packages/cli/lang/en.json b/packages/cli/lang/en.json index 6f0b55d11d..2e5e39b423 100644 --- a/packages/cli/lang/en.json +++ b/packages/cli/lang/en.json @@ -143,7 +143,7 @@ "commands_run_options_workflowScript": "Path to workflow script", "commands_run_options_configPath": "config-path", "commands_run_options_outputFilePath": "output-file-path", - "commands_run_options_config": "Add custom configuration to the Web3ApiClient", + "commands_run_options_config": "Add custom configuration to the PolywrapClient", "commands_run_options_validateScript": "Validate the output of the workflow jobs", "commands_run_options_validate": "cue-file", "commands_run_options_outputFile": "Output file path for the workflow result", diff --git a/packages/cli/lang/es.json b/packages/cli/lang/es.json index 7bdb3a6700..952b085e81 100644 --- a/packages/cli/lang/es.json +++ b/packages/cli/lang/es.json @@ -143,7 +143,7 @@ "commands_run_options_workflowScript": "Path to workflow script", "commands_run_options_configPath": "config-path", "commands_run_options_outputFilePath": "output-file-path", - "commands_run_options_config": "Add custom configuration to the Web3ApiClient", + "commands_run_options_config": "Add custom configuration to the PolywrapClient", "commands_run_options_validateScript": "Validate the output of the workflow jobs", "commands_run_options_validate": "cue-file", "commands_run_options_outputFile": "Output file path for the workflow result", diff --git a/packages/cli/src/__tests__/e2e/help.spec.ts b/packages/cli/src/__tests__/e2e/help.spec.ts index af9adaaa25..8c9f3797ef 100644 --- a/packages/cli/src/__tests__/e2e/help.spec.ts +++ b/packages/cli/src/__tests__/e2e/help.spec.ts @@ -15,7 +15,7 @@ Commands: create|c Create a new project with polywrap CLI deploy|d [options] Deploys/Publishes a Polywrap plugin|p Build/generate types for the plugin - infra|i [options] Manage infrastructure for your Web3API + infra|i [options] Manage infrastructure for your wrapper run|r [options] Runs workflow script help [command] display help for command `; diff --git a/packages/cli/src/__tests__/e2e/no-command.spec.ts b/packages/cli/src/__tests__/e2e/no-command.spec.ts index 1ca9833d4c..87976e9502 100644 --- a/packages/cli/src/__tests__/e2e/no-command.spec.ts +++ b/packages/cli/src/__tests__/e2e/no-command.spec.ts @@ -15,7 +15,7 @@ Commands: create|c Create a new project with polywrap CLI deploy|d [options] Deploys/Publishes a Polywrap plugin|p Build/generate types for the plugin - infra|i [options] Manage infrastructure for your Web3API + infra|i [options] Manage infrastructure for your wrapper run|r [options] Runs workflow script help [command] display help for command `; diff --git a/packages/cli/src/__tests__/e2e/run.spec.ts b/packages/cli/src/__tests__/e2e/run.spec.ts index d99222bf84..28e2b88f56 100644 --- a/packages/cli/src/__tests__/e2e/run.spec.ts +++ b/packages/cli/src/__tests__/e2e/run.spec.ts @@ -2,18 +2,18 @@ import fs from "fs"; import path from "path"; import yaml from "js-yaml"; -import { clearStyle, parseOutput, w3Cli } from "./utils"; +import { clearStyle, parseOutput, polywrapCli } from "./utils"; import { - buildAndDeployApi, + buildAndDeployWrapper, initTestEnvironment, runCLI, -} from "@web3api/test-env-js"; -import { GetPathToCliTestFiles } from "@web3api/test-cases"; +} from "@polywrap/test-env-js"; +import { GetPathToCliTestFiles } from "@polywrap/test-cases"; jest.setTimeout(200000); -const HELP = `Usage: w3 run|r [options] +const HELP = `Usage: polywrap run|r [options] Runs workflow script @@ -22,7 +22,7 @@ Arguments: Options: -c, --client-config Add custom configuration to the - Web3ApiClient + PolywrapClient -v, --validate-script Validate the output of the workflow jobs -o, --output-file Output file path for the workflow @@ -51,7 +51,7 @@ describe("sanity tests for workflow command", () => { const { exitCode, stdout, stderr } = await runCLI({ args: ["run"], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(exitCode).toEqual(1); @@ -63,7 +63,7 @@ describe("sanity tests for workflow command", () => { const { exitCode, stdout, stderr } = await runCLI({ args: ["run", "./recipes/e2e.json", "--client-config"], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(exitCode).toEqual(1); @@ -80,8 +80,8 @@ describe("e2e tests for run command", () => { beforeAll(async () => { await initTestEnvironment(); - await buildAndDeployApi({ - apiAbsPath: testCaseRoot, + await buildAndDeployWrapper({ + wrapperAbsPath: testCaseRoot, ipfsProvider: "http://localhost:5001", ethereumProvider: "http://localhost:8545", ensName: "simple-storage.eth", @@ -92,7 +92,7 @@ describe("e2e tests for run command", () => { await runCLI({ args: ["test-env", "down"], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); }); @@ -100,7 +100,7 @@ describe("e2e tests for run command", () => { const { exitCode: code, stdout, stderr } = await runCLI({ args: ["run", "./workflows/e2e.json", "-c", "./workflows/config.ts"], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(code).toEqual(0); expect(stderr).toBe(""); @@ -117,7 +117,7 @@ describe("e2e tests for run command", () => { const { exitCode: code, stdout, stderr } = await runCLI({ args: ["run", "./workflows/e2e.yaml", "-c", "./workflows/config.ts"], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(code).toEqual(0); @@ -142,7 +142,7 @@ describe("e2e tests for run command", () => { "./workflows/output.json", ], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(code).toEqual(0); @@ -170,7 +170,7 @@ describe("e2e tests for run command", () => { "./workflows/output.yaml", ], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(code).toEqual(0); @@ -201,7 +201,7 @@ describe("e2e tests for run command", () => { "--quiet", ], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(code).toEqual(0); @@ -221,7 +221,7 @@ describe("e2e tests for run command", () => { "-q", ], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(code).toEqual(0); @@ -240,7 +240,7 @@ describe("e2e tests for run command", () => { "-q", ], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(code).toEqual(1); From 64cb025899625d7c57a3134f709b40f6ee67ca69 Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Mon, 20 Jun 2022 15:08:49 +0400 Subject: [PATCH 18/38] fix: issues --- packages/cli/lang/en.json | 16 +- packages/cli/lang/es.json | 16 +- packages/cli/src/__tests__/e2e/run.spec.ts | 39 +- .../api/assemblyscript/workflows/config.ts | 26 +- .../.w3/web3api/deploy/modules/ens/index.js | 148 -- .../web3api/deploy/modules/ens/index.js.map | 1 - .../modules/ens/web3api.deploy.ext.json | 23 - .../.w3/web3api/deploy/modules/ipfs/index.js | 114 -- .../web3api/deploy/modules/ipfs/index.js.map | 1 - .../modules/ipfs/web3api.deploy.ext.json | 12 - .../cases/cli/api/run/src/w3/Module/index.ts | 11 - .../api/run/src/w3/Module/serialization.ts | 193 --- .../cli/api/run/src/w3/Module/wrapped.ts | 39 - .../api/run/src/w3/SetDataOptions/index.ts | 47 - .../src/w3/SetDataOptions/serialization.ts | 84 - .../cli/api/run/src/w3/SetDataResult/index.ts | 47 - .../run/src/w3/SetDataResult/serialization.ts | 84 - .../cases/cli/api/run/src/w3/entry.ts | 48 - .../src/w3/imported/Ethereum_Access/index.ts | 50 - .../imported/Ethereum_Access/serialization.ts | 88 -- .../w3/imported/Ethereum_Connection/index.ts | 50 - .../Ethereum_Connection/serialization.ts | 74 - .../Ethereum_EventNotification/index.ts | 51 - .../serialization.ts | 101 -- .../run/src/w3/imported/Ethereum_Log/index.ts | 57 - .../w3/imported/Ethereum_Log/serialization.ts | 200 --- .../src/w3/imported/Ethereum_Module/index.ts | 665 -------- .../imported/Ethereum_Module/serialization.ts | 1366 ----------------- .../src/w3/imported/Ethereum_Network/index.ts | 51 - .../Ethereum_Network/serialization.ts | 95 -- .../imported/Ethereum_StaticTxResult/index.ts | 50 - .../Ethereum_StaticTxResult/serialization.ts | 84 - .../w3/imported/Ethereum_TxOverrides/index.ts | 51 - .../Ethereum_TxOverrides/serialization.ts | 85 - .../w3/imported/Ethereum_TxReceipt/index.ts | 65 - .../Ethereum_TxReceipt/serialization.ts | 319 ---- .../w3/imported/Ethereum_TxRequest/index.ts | 57 - .../Ethereum_TxRequest/serialization.ts | 151 -- .../w3/imported/Ethereum_TxResponse/index.ts | 67 - .../Ethereum_TxResponse/serialization.ts | 306 ---- .../cli/api/run/src/w3/imported/index.ts | 11 - .../cases/cli/api/run/src/w3/index.ts | 23 - .../api/run/web3api.deploy.fail-between.yaml | 19 - .../run/web3api.deploy.invalid-config.yaml | 12 - .../cli/api/run/web3api.deploy.no-ext.yaml | 7 - .../test-cases/cases/cli/api/run/web3api.yaml | 7 - .../cases/cli/wasm/query/recipes/e2e.json | 14 - .../cases/cli/wasm/query/recipes/e2e.yaml | 7 - .../{query => run}/client-async-config.js | 0 .../{query => run}/client-async-config.ts | 0 .../cli/wasm/{query => run}/client-config.js | 0 .../cli/wasm/{query => run}/client-config.ts | 0 .../wasm/{query => run}/deploy-contracts.js | 0 .../cli/wasm/{query => run}/package.json | 0 .../wasm/{query => run}/polywrap.build.yaml | 0 .../polywrap.deploy.fail-between.yaml | 0 .../polywrap.deploy.invalid-config.yaml | 0 .../polywrap.deploy.no-ext.yaml | 0 .../cases/cli/wasm/run/polywrap.deploy.yaml | 26 + .../cli/wasm/{query => run}/polywrap.yaml | 0 .../cli/wasm/{query => run}/schema.graphql | 0 .../cli/wasm/{query => run}/src/index.ts | 0 .../cli/{api => wasm}/run/workflows/config.ts | 26 +- .../cli/{api => wasm}/run/workflows/e2e.json | 0 .../cli/{api => wasm}/run/workflows/e2e.yaml | 0 .../{api => wasm}/run/workflows/validator.cue | 0 66 files changed, 88 insertions(+), 5096 deletions(-) delete mode 100644 packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ens/index.js delete mode 100644 packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ens/index.js.map delete mode 100644 packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ens/web3api.deploy.ext.json delete mode 100644 packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ipfs/index.js delete mode 100644 packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ipfs/index.js.map delete mode 100644 packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ipfs/web3api.deploy.ext.json delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/Module/index.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/Module/serialization.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/Module/wrapped.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/SetDataOptions/index.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/SetDataOptions/serialization.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/SetDataResult/index.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/SetDataResult/serialization.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/entry.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Access/index.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Access/serialization.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Connection/index.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Connection/serialization.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_EventNotification/index.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_EventNotification/serialization.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Log/index.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Log/serialization.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Module/index.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Module/serialization.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Network/index.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Network/serialization.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_StaticTxResult/index.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_StaticTxResult/serialization.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxOverrides/index.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxOverrides/serialization.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxReceipt/index.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxReceipt/serialization.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxRequest/index.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxRequest/serialization.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxResponse/index.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxResponse/serialization.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/imported/index.ts delete mode 100644 packages/test-cases/cases/cli/api/run/src/w3/index.ts delete mode 100644 packages/test-cases/cases/cli/api/run/web3api.deploy.fail-between.yaml delete mode 100644 packages/test-cases/cases/cli/api/run/web3api.deploy.invalid-config.yaml delete mode 100644 packages/test-cases/cases/cli/api/run/web3api.deploy.no-ext.yaml delete mode 100644 packages/test-cases/cases/cli/api/run/web3api.yaml delete mode 100644 packages/test-cases/cases/cli/wasm/query/recipes/e2e.json delete mode 100644 packages/test-cases/cases/cli/wasm/query/recipes/e2e.yaml rename packages/test-cases/cases/cli/wasm/{query => run}/client-async-config.js (100%) rename packages/test-cases/cases/cli/wasm/{query => run}/client-async-config.ts (100%) rename packages/test-cases/cases/cli/wasm/{query => run}/client-config.js (100%) rename packages/test-cases/cases/cli/wasm/{query => run}/client-config.ts (100%) rename packages/test-cases/cases/cli/wasm/{query => run}/deploy-contracts.js (100%) rename packages/test-cases/cases/cli/wasm/{query => run}/package.json (100%) rename packages/test-cases/cases/cli/wasm/{query => run}/polywrap.build.yaml (100%) rename packages/test-cases/cases/cli/wasm/{query => run}/polywrap.deploy.fail-between.yaml (100%) rename packages/test-cases/cases/cli/wasm/{query => run}/polywrap.deploy.invalid-config.yaml (100%) rename packages/test-cases/cases/cli/wasm/{query => run}/polywrap.deploy.no-ext.yaml (100%) create mode 100644 packages/test-cases/cases/cli/wasm/run/polywrap.deploy.yaml rename packages/test-cases/cases/cli/wasm/{query => run}/polywrap.yaml (100%) rename packages/test-cases/cases/cli/wasm/{query => run}/schema.graphql (100%) rename packages/test-cases/cases/cli/wasm/{query => run}/src/index.ts (100%) rename packages/test-cases/cases/cli/{api => wasm}/run/workflows/config.ts (70%) rename packages/test-cases/cases/cli/{api => wasm}/run/workflows/e2e.json (100%) rename packages/test-cases/cases/cli/{api => wasm}/run/workflows/e2e.yaml (100%) rename packages/test-cases/cases/cli/{api => wasm}/run/workflows/validator.cue (100%) diff --git a/packages/cli/lang/en.json b/packages/cli/lang/en.json index 6f0b55d11d..ac7a3beaae 100644 --- a/packages/cli/lang/en.json +++ b/packages/cli/lang/en.json @@ -143,7 +143,7 @@ "commands_run_options_workflowScript": "Path to workflow script", "commands_run_options_configPath": "config-path", "commands_run_options_outputFilePath": "output-file-path", - "commands_run_options_config": "Add custom configuration to the Web3ApiClient", + "commands_run_options_config": "Add custom configuration to the PolywrapClient", "commands_run_options_validateScript": "Validate the output of the workflow jobs", "commands_run_options_validate": "cue-file", "commands_run_options_outputFile": "Output file path for the workflow result", @@ -158,24 +158,24 @@ "commands_run_error_clientConfigNotObject": "Custom client config must be an object", "commands_run_error_redirectsExportNotArray": "Exported redirects must be an array", "commands_run_error_redirectsItemNotValid": "Redirect at index {index} must be an object with properties 'from' and 'to'", - "commands_run_error_redirectsItemFromNotString": "Redirect property 'from' at index {index} must be a valid w3:// URI string", - "commands_run_error_redirectsItemToNotStringOrObject": "Redirect property 'to' at index {index} must be a valid w3:// URI string, or a plugin", + "commands_run_error_redirectsItemFromNotString": "Redirect property 'from' at index {index} must be a valid wrap:// URI string", + "commands_run_error_redirectsItemToNotStringOrObject": "Redirect property 'to' at index {index} must be a valid wrap:// URI string, or a plugin", "commands_run_error_redirectsItemToNotValidPlugin": "Redirect property 'to' at index {index} must be a valid plugin instance", "commands_run_error_pluginsExportNotArray": "Exported plugins must be an array", "commands_run_error_pluginsItemNotObject": "Plugin at index {index} must be an object with properties 'uri' and 'plugin'", - "commands_run_error_pluginsItemUriNotString": "Plugin property 'uri' at index {index} must be a valid w3:// URI string", + "commands_run_error_pluginsItemUriNotString": "Plugin property 'uri' at index {index} must be a valid wrap:// URI string", "commands_run_error_pluginsItemPluginNotObject": "Plugin property 'plugin' at index {index} must be an object with properties 'factory' and 'manifest'", "commands_run_error_pluginsItemPluginFactoryNotFunction": "Plugin property 'plugin.factory' at index {index} must be a function", "commands_run_error_pluginsItemPluginManifestNotObject": "Plugin property 'plugin.manifest' at index {index} must be an object", "commands_run_error_interfacesExportNotArray": "Exported interfaces must be an array", "commands_run_error_interfacesItemNotObject": "Interface at index {index} must be an object with properties 'interface' and 'implementations'", - "commands_run_error_interfacesItemInterfaceNotString": "Interface property 'interface' at index {index} must be a valid w3:// URI string", + "commands_run_error_interfacesItemInterfaceNotString": "Interface property 'interface' at index {index} must be a valid wrap:// URI string", "commands_run_error_interfacesItemImplementationsNotArray": "Interface property 'implementations' at index {index} must be an array", "commands_run_error_interfacesItemImplementationsEmpty": "Interface property 'implementations' at index {index} must not be an empty array", - "commands_run_error_interfacesItemImplementationsItemNotString": "Implementation at index ({index}, {implementationIndex}) must be a valid w3:// URI string", + "commands_run_error_interfacesItemImplementationsItemNotString": "Implementation at index ({index}, {implementationIndex}) must be a valid wrap:// URI string", "commands_run_error_envsExportNotArray": "Exported envs must be an array", "commands_run_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri' and optional properties 'common', 'query', and 'mutation'", - "commands_run_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid w3:// URI string", + "commands_run_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid wrap:// URI string", "commands_run_error_envsItemModuleNotObject": "Env property 'module' at index {index} must be an object", "commands_run_description": "Runs workflow script", "commands_run_error_missingScript": "Required argument {script} is missing", @@ -183,7 +183,7 @@ "commands_run_error_readFail": "Failed to read query {query}", "commands_run_error_noWorkflowScriptFound": "Workflow script not found at path: {path}", "commands_run_error_noTestEnvFound": "w3 test-env not found, please run 'w3 test-env up'", - "commands_testEnv_description": "Manage a test environment for Web3API", + "commands_testEnv_description": "Manage a test environment for Polywrap", "commands_testEnv_error_never": "This should never happen...", "commands_testEnv_error_noCommand": "No command given", "commands_testEnv_error_unrecognizedCommand": "Unrecognized command: {command}", diff --git a/packages/cli/lang/es.json b/packages/cli/lang/es.json index 7bdb3a6700..c9e3b9866d 100644 --- a/packages/cli/lang/es.json +++ b/packages/cli/lang/es.json @@ -143,7 +143,7 @@ "commands_run_options_workflowScript": "Path to workflow script", "commands_run_options_configPath": "config-path", "commands_run_options_outputFilePath": "output-file-path", - "commands_run_options_config": "Add custom configuration to the Web3ApiClient", + "commands_run_options_config": "Add custom configuration to the PolywrapClient", "commands_run_options_validateScript": "Validate the output of the workflow jobs", "commands_run_options_validate": "cue-file", "commands_run_options_outputFile": "Output file path for the workflow result", @@ -158,24 +158,24 @@ "commands_run_error_clientConfigNotObject": "Custom client config must be an object", "commands_run_error_redirectsExportNotArray": "Exported redirects must be an array", "commands_run_error_redirectsItemNotValid": "Redirect at index {index} must be an object with properties 'from' and 'to'", - "commands_run_error_redirectsItemFromNotString": "Redirect property 'from' at index {index} must be a valid w3:// URI string", - "commands_run_error_redirectsItemToNotStringOrObject": "Redirect property 'to' at index {index} must be a valid w3:// URI string, or a plugin", + "commands_run_error_redirectsItemFromNotString": "Redirect property 'from' at index {index} must be a valid wrap:// URI string", + "commands_run_error_redirectsItemToNotStringOrObject": "Redirect property 'to' at index {index} must be a valid wrap:// URI string, or a plugin", "commands_run_error_redirectsItemToNotValidPlugin": "Redirect property 'to' at index {index} must be a valid plugin instance", "commands_run_error_pluginsExportNotArray": "Exported plugins must be an array", "commands_run_error_pluginsItemNotObject": "Plugin at index {index} must be an object with properties 'uri' and 'plugin'", - "commands_run_error_pluginsItemUriNotString": "Plugin property 'uri' at index {index} must be a valid w3:// URI string", + "commands_run_error_pluginsItemUriNotString": "Plugin property 'uri' at index {index} must be a valid wrap:// URI string", "commands_run_error_pluginsItemPluginNotObject": "Plugin property 'plugin' at index {index} must be an object with properties 'factory' and 'manifest'", "commands_run_error_pluginsItemPluginFactoryNotFunction": "Plugin property 'plugin.factory' at index {index} must be a function", "commands_run_error_pluginsItemPluginManifestNotObject": "Plugin property 'plugin.manifest' at index {index} must be an object", "commands_run_error_interfacesExportNotArray": "Exported interfaces must be an array", "commands_run_error_interfacesItemNotObject": "Interface at index {index} must be an object with properties 'interface' and 'implementations'", - "commands_run_error_interfacesItemInterfaceNotString": "Interface property 'interface' at index {index} must be a valid w3:// URI string", + "commands_run_error_interfacesItemInterfaceNotString": "Interface property 'interface' at index {index} must be a valid wrap:// URI string", "commands_run_error_interfacesItemImplementationsNotArray": "Interface property 'implementations' at index {index} must be an array", "commands_run_error_interfacesItemImplementationsEmpty": "Interface property 'implementations' at index {index} must not be an empty array", - "commands_run_error_interfacesItemImplementationsItemNotString": "Implementation at index ({index}, {implementationIndex}) must be a valid w3:// URI string", + "commands_run_error_interfacesItemImplementationsItemNotString": "Implementation at index ({index}, {implementationIndex}) must be a valid wrap:// URI string", "commands_run_error_envsExportNotArray": "Exported envs must be an array", "commands_run_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri' and optional properties 'common', 'query', and 'mutation'", - "commands_run_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid w3:// URI string", + "commands_run_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid wrap:// URI string", "commands_run_error_envsItemModuleNotObject": "Env property 'common' at index {index} must be an object", "commands_run_description": "Runs workflow script", "commands_run_error_missingScript": "Required argument {script} is missing", @@ -183,7 +183,7 @@ "commands_run_error_readFail": "Failed to read query {query}", "commands_run_error_noWorkflowScriptFound": "Workflow script not found at path: {path}", "commands_run_error_noTestEnvFound": "w3 test-env not found, please run 'w3 test-env up'", - "commands_testEnv_description": "Manage a test environment for Web3API", + "commands_testEnv_description": "Manage a test environment for Polywrap", "commands_testEnv_error_never": "This should never happen...", "commands_testEnv_error_noCommand": "No command given", "commands_testEnv_error_unrecognizedCommand": "Unrecognized command: {command}", diff --git a/packages/cli/src/__tests__/e2e/run.spec.ts b/packages/cli/src/__tests__/e2e/run.spec.ts index d99222bf84..2987e139d9 100644 --- a/packages/cli/src/__tests__/e2e/run.spec.ts +++ b/packages/cli/src/__tests__/e2e/run.spec.ts @@ -2,18 +2,18 @@ import fs from "fs"; import path from "path"; import yaml from "js-yaml"; -import { clearStyle, parseOutput, w3Cli } from "./utils"; +import { clearStyle, parseOutput, polywrapCli } from "./utils"; import { - buildAndDeployApi, + buildAndDeployWrapper, initTestEnvironment, runCLI, -} from "@web3api/test-env-js"; -import { GetPathToCliTestFiles } from "@web3api/test-cases"; +} from "@polywrap/test-env-js"; +import { GetPathToCliTestFiles } from "@polywrap/test-cases"; jest.setTimeout(200000); -const HELP = `Usage: w3 run|r [options] +const HELP = `Usage: polywrap run|r [options] Runs workflow script @@ -34,7 +34,7 @@ Options: `; describe("sanity tests for workflow command", () => { - const testCaseRoot = path.join(GetPathToCliTestFiles(), "api/run"); + const testCaseRoot = path.join(GetPathToCliTestFiles(), "wasm/run"); it("Should show help text", async () => { const { exitCode: code, stdout: output, stderr: error } = await runCLI({ @@ -51,7 +51,7 @@ describe("sanity tests for workflow command", () => { const { exitCode, stdout, stderr } = await runCLI({ args: ["run"], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(exitCode).toEqual(1); @@ -63,7 +63,7 @@ describe("sanity tests for workflow command", () => { const { exitCode, stdout, stderr } = await runCLI({ args: ["run", "./recipes/e2e.json", "--client-config"], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(exitCode).toEqual(1); @@ -75,13 +75,13 @@ describe("sanity tests for workflow command", () => { }); describe("e2e tests for run command", () => { - const testCaseRoot = path.join(GetPathToCliTestFiles(), "api/run"); + const testCaseRoot = path.join(GetPathToCliTestFiles(), "wasm/run"); beforeAll(async () => { await initTestEnvironment(); - await buildAndDeployApi({ - apiAbsPath: testCaseRoot, + await buildAndDeployWrapper({ + wrapperAbsPath: testCaseRoot, ipfsProvider: "http://localhost:5001", ethereumProvider: "http://localhost:8545", ensName: "simple-storage.eth", @@ -92,7 +92,7 @@ describe("e2e tests for run command", () => { await runCLI({ args: ["test-env", "down"], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); }); @@ -100,8 +100,9 @@ describe("e2e tests for run command", () => { const { exitCode: code, stdout, stderr } = await runCLI({ args: ["run", "./workflows/e2e.json", "-c", "./workflows/config.ts"], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); + expect(code).toEqual(0); expect(stderr).toBe(""); @@ -117,7 +118,7 @@ describe("e2e tests for run command", () => { const { exitCode: code, stdout, stderr } = await runCLI({ args: ["run", "./workflows/e2e.yaml", "-c", "./workflows/config.ts"], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(code).toEqual(0); @@ -142,7 +143,7 @@ describe("e2e tests for run command", () => { "./workflows/output.json", ], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(code).toEqual(0); @@ -170,7 +171,7 @@ describe("e2e tests for run command", () => { "./workflows/output.yaml", ], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(code).toEqual(0); @@ -201,7 +202,7 @@ describe("e2e tests for run command", () => { "--quiet", ], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(code).toEqual(0); @@ -221,7 +222,7 @@ describe("e2e tests for run command", () => { "-q", ], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(code).toEqual(0); @@ -240,7 +241,7 @@ describe("e2e tests for run command", () => { "-q", ], cwd: testCaseRoot, - cli: w3Cli, + cli: polywrapCli, }); expect(code).toEqual(1); diff --git a/packages/templates/api/assemblyscript/workflows/config.ts b/packages/templates/api/assemblyscript/workflows/config.ts index d143db8cc8..9e0ec05fbd 100644 --- a/packages/templates/api/assemblyscript/workflows/config.ts +++ b/packages/templates/api/assemblyscript/workflows/config.ts @@ -1,8 +1,8 @@ -import { Web3ApiClientConfig } from "@web3api/client-js"; -import { ClientConfig, coreInterfaceUris } from "@web3api/client-js"; -import { ensPlugin } from "@web3api/ens-plugin-js"; -import { ethereumPlugin } from "@web3api/ethereum-plugin-js"; -import { ipfsPlugin } from "@web3api/ipfs-plugin-js"; +import { PolywrapClientConfig } from "@polywrap/client-js"; +import { ClientConfig, coreInterfaceUris } from "@polywrap/client-js"; +import { ensPlugin } from "@polywrap/ens-plugin-js"; +import { ethereumPlugin } from "@polywrap/ethereum-plugin-js"; +import { ipfsPlugin } from "@polywrap/ipfs-plugin-js"; interface TestEnvironment { ipfs: string; @@ -30,15 +30,15 @@ function getPlugins( redirects: [], plugins: [ { - uri: "w3://ens/ipfs.web3api.eth", + uri: "wrap://ens/ipfs.polywrap.eth", plugin: ipfsPlugin({ provider: ipfs }), }, { - uri: "w3://ens/ens.web3api.eth", + uri: "wrap://ens/ens.polywrap.eth", plugin: ensPlugin({ query: { addresses: { testnet: ensAddress } } }), }, { - uri: "w3://ens/ethereum.web3api.eth", + uri: "wrap://ens/ethereum.polywrap.eth", plugin: ethereumPlugin({ networks: { testnet: { @@ -56,21 +56,21 @@ function getPlugins( { interface: coreInterfaceUris.uriResolver.uri, implementations: [ - "w3://ens/ipfs.web3api.eth", - "w3://ens/ens.web3api.eth", + "wrap://ens/ipfs.polywrap.eth", + "wrap://ens/ens.polywrap.eth", ], }, { interface: coreInterfaceUris.logger.uri, - implementations: ["w3://ens/js-logger.web3api.eth"], + implementations: ["wrap://ens/js-logger.polywrap.eth"], }, ], }; } export async function getClientConfig( - _: Partial -): Promise> { + _: Partial +): Promise> { const { ipfs, ethereum, ensAddress } = await getProviders(); return getPlugins(ethereum, ipfs, ensAddress); diff --git a/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ens/index.js b/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ens/index.js deleted file mode 100644 index bf8370e74a..0000000000 --- a/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ens/index.js +++ /dev/null @@ -1,148 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var wallet_1 = require("@ethersproject/wallet"); -var providers_1 = require("@ethersproject/providers"); -var core_js_1 = require("@web3api/core-js"); -var client_js_1 = require("@web3api/client-js"); -var path_1 = __importDefault(require("path")); -var ethereum_plugin_js_1 = require("@web3api/ethereum-plugin-js"); -var contentHash = require("content-hash"); -var ENSPublisher = /** @class */ (function () { - function ENSPublisher() { - } - ENSPublisher.prototype.execute = function (uri, config) { - return __awaiter(this, void 0, void 0, function () { - var cid, connectionProvider, _a, chainIdNum, networkName, network, signer, ethereumPluginUri, ensWrapperUri, client, resolver, hash, setContenthashData; - var _b; - return __generator(this, function (_c) { - switch (_c.label) { - case 0: - if (uri.authority !== "ipfs") { - throw new Error("ENS Deployer: resolved URI from " + uri + " does not represent an IPFS contentHash"); - } - cid = uri.path; - connectionProvider = new providers_1.JsonRpcProvider(config.provider); - return [4 /*yield*/, connectionProvider.getNetwork()]; - case 1: - _a = _c.sent(), chainIdNum = _a.chainId, networkName = _a.name; - network = chainIdNum === 1337 ? "testnet" : networkName; - signer = config.privateKey - ? new wallet_1.Wallet(config.privateKey).connect(connectionProvider) - : undefined; - ethereumPluginUri = "w3://ens/ethereum.web3api.eth"; - ensWrapperUri = "fs/" + path_1.default.join(path_1.default.dirname(require.resolve("@web3api/test-env-js")), "wrappers", "ens"); - client = new client_js_1.Web3ApiClient({ - plugins: [ - { - uri: ethereumPluginUri, - plugin: ethereum_plugin_js_1.ethereumPlugin({ - networks: (_b = {}, - _b[network] = { - provider: config.provider, - signer: signer, - }, - _b), - defaultNetwork: network, - }), - }, - ], - }); - return [4 /*yield*/, client.invoke({ - method: "getResolver", - uri: ensWrapperUri, - input: { - registryAddress: config.ensRegistryAddress, - domain: config.domainName, - connection: { - networkNameOrChainId: network, - }, - }, - })]; - case 2: - resolver = (_c.sent()).data; - if (!resolver) { - throw new Error("Could not get resolver for '" + config.domainName + "'"); - } - if (resolver === "0x0000000000000000000000000000000000000000") { - throw new Error("Resolver not set for '" + config.domainName + "'"); - } - hash = "0x" + contentHash.fromIpfs(cid); - return [4 /*yield*/, client.invoke({ - method: "setContentHash", - uri: ensWrapperUri, - input: { - domain: config.domainName, - cid: hash, - resolverAddress: resolver, - connection: { - networkNameOrChainId: network, - }, - }, - })]; - case 3: - setContenthashData = (_c.sent()).data; - if (!setContenthashData) { - throw new Error("Could not set contentHash for '" + config.domainName + "'"); - } - return [4 /*yield*/, client.invoke({ - method: "awaitTransaction", - uri: ethereumPluginUri, - input: { - txHash: setContenthashData.hash, - confirmations: 1, - timeout: 15000, - connection: { - networkNameOrChainId: network, - }, - }, - })]; - case 4: - _c.sent(); - return [2 /*return*/, new core_js_1.Uri("ens/" + config.domainName)]; - } - }); - }); - }; - return ENSPublisher; -}()); -exports.default = new ENSPublisher(); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ens/index.js.map b/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ens/index.js.map deleted file mode 100644 index 8a80356043..0000000000 --- a/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ens/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/defaults/deploy-modules/ens/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,gDAA+C;AAC/C,sDAA2D;AAC3D,4CAAuC;AACvC,gDAAmD;AACnD,8CAAwB;AACxB,kEAA6D;AAE7D,IAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAE5C;IAAA;IA4GA,CAAC;IA3GO,8BAAO,GAAb,UACE,GAAQ,EACR,MAKC;;;;;;;wBAED,IAAI,GAAG,CAAC,SAAS,KAAK,MAAM,EAAE;4BAC5B,MAAM,IAAI,KAAK,CACb,qCAAmC,GAAG,4CAAyC,CAChF,CAAC;yBACH;wBAEK,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC;wBAEf,kBAAkB,GAAG,IAAI,2BAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;wBAI5D,qBAAM,kBAAkB,CAAC,UAAU,EAAE,EAAA;;wBAHnC,KAGF,SAAqC,EAF9B,UAAU,aAAA,EACb,WAAW,UAAA;wBAGb,OAAO,GAAG,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC;wBAExD,MAAM,GAAG,MAAM,CAAC,UAAU;4BAC9B,CAAC,CAAC,IAAI,eAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;4BAC3D,CAAC,CAAC,SAAS,CAAC;wBAER,iBAAiB,GAAG,+BAA+B,CAAC;wBACpD,aAAa,GAAG,QAAM,cAAI,CAAC,IAAI,CACnC,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,EACrD,UAAU,EACV,KAAK,CACJ,CAAC;wBAEE,MAAM,GAAG,IAAI,yBAAa,CAAC;4BAC/B,OAAO,EAAE;gCACP;oCACE,GAAG,EAAE,iBAAiB;oCACtB,MAAM,EAAE,mCAAc,CAAC;wCACrB,QAAQ;4CACN,GAAC,OAAO,IAAG;gDACT,QAAQ,EAAE,MAAM,CAAC,QAAQ;gDACzB,MAAM,QAAA;6CACP;+CACF;wCACD,cAAc,EAAE,OAAO;qCACxB,CAAC;iCACH;6BACF;yBACF,CAAC,CAAC;wBAEwB,qBAAM,MAAM,CAAC,MAAM,CAAS;gCACrD,MAAM,EAAE,aAAa;gCACrB,GAAG,EAAE,aAAa;gCAClB,KAAK,EAAE;oCACL,eAAe,EAAE,MAAM,CAAC,kBAAkB;oCAC1C,MAAM,EAAE,MAAM,CAAC,UAAU;oCACzB,UAAU,EAAE;wCACV,oBAAoB,EAAE,OAAO;qCAC9B;iCACF;6BACF,CAAC,EAAA;;wBAVY,QAAQ,GAAK,CAAA,SAUzB,CAAA,KAVoB;wBAYtB,IAAI,CAAC,QAAQ,EAAE;4BACb,MAAM,IAAI,KAAK,CAAC,iCAA+B,MAAM,CAAC,UAAU,MAAG,CAAC,CAAC;yBACtE;wBAED,IAAI,QAAQ,KAAK,4CAA4C,EAAE;4BAC7D,MAAM,IAAI,KAAK,CAAC,2BAAyB,MAAM,CAAC,UAAU,MAAG,CAAC,CAAC;yBAChE;wBAEK,IAAI,GAAG,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;wBAET,qBAAM,MAAM,CAAC,MAAM,CAAmB;gCACzE,MAAM,EAAE,gBAAgB;gCACxB,GAAG,EAAE,aAAa;gCAClB,KAAK,EAAE;oCACL,MAAM,EAAE,MAAM,CAAC,UAAU;oCACzB,GAAG,EAAE,IAAI;oCACT,eAAe,EAAE,QAAQ;oCACzB,UAAU,EAAE;wCACV,oBAAoB,EAAE,OAAO;qCAC9B;iCACF;6BACF,CAAC,EAAA;;wBAXY,kBAAkB,GAAK,CAAA,SAWnC,CAAA,KAX8B;wBAahC,IAAI,CAAC,kBAAkB,EAAE;4BACvB,MAAM,IAAI,KAAK,CAAC,oCAAkC,MAAM,CAAC,UAAU,MAAG,CAAC,CAAC;yBACzE;wBAED,qBAAM,MAAM,CAAC,MAAM,CAAC;gCAClB,MAAM,EAAE,kBAAkB;gCAC1B,GAAG,EAAE,iBAAiB;gCACtB,KAAK,EAAE;oCACL,MAAM,EAAE,kBAAkB,CAAC,IAAI;oCAC/B,aAAa,EAAE,CAAC;oCAChB,OAAO,EAAE,KAAK;oCACd,UAAU,EAAE;wCACV,oBAAoB,EAAE,OAAO;qCAC9B;iCACF;6BACF,CAAC,EAAA;;wBAXF,SAWE,CAAC;wBAEH,sBAAO,IAAI,aAAG,CAAC,SAAO,MAAM,CAAC,UAAY,CAAC,EAAC;;;;KAC5C;IACH,mBAAC;AAAD,CAAC,AA5GD,IA4GC;AAED,kBAAe,IAAI,YAAY,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ens/web3api.deploy.ext.json b/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ens/web3api.deploy.ext.json deleted file mode 100644 index 180605c257..0000000000 --- a/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ens/web3api.deploy.ext.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "id": "DeployManifest_ENS_WasmAsExt", - "type": "object", - "required": [ - "domainName", - "provider", - "ensRegistryAddress" - ], - "properties": { - "domainName": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "privateKey": { - "type": "string" - }, - "ensRegistryAddress": { - "type": "string" - } - } -} \ No newline at end of file diff --git a/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ipfs/index.js b/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ipfs/index.js deleted file mode 100644 index 956ad7288d..0000000000 --- a/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ipfs/index.js +++ /dev/null @@ -1,114 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var __asyncValues = (this && this.__asyncValues) || function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var core_js_1 = require("@web3api/core-js"); -// eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/no-var-requires,@typescript-eslint/naming-convention -var IPFSClient = require("ipfs-http-client"); -var globSource = IPFSClient.globSource; -var isValidUri = function (uri) { return uri.authority === "fs"; }; -var IPFSDeployer = /** @class */ (function () { - function IPFSDeployer() { - } - IPFSDeployer.prototype.execute = function (uri, config) { - var e_1, _a; - var _b; - return __awaiter(this, void 0, void 0, function () { - var path, ipfsUrl, client, globOptions, addOptions, rootCID, _c, _d, file, e_1_1; - return __generator(this, function (_e) { - switch (_e.label) { - case 0: - if (!isValidUri(uri)) { - throw new Error("IPFS Deployer error: Invalid URI: " + uri.toString() + ". Supplied URI needs to be a Filesystem URI, example: fs/./build"); - } - path = uri.path; - ipfsUrl = (_b = config === null || config === void 0 ? void 0 : config.gatewayUri) !== null && _b !== void 0 ? _b : "http://localhost:5001"; - client = new IPFSClient({ url: ipfsUrl }); - globOptions = { - recursive: true, - }; - addOptions = { - wrapWithDirectory: false, - }; - rootCID = ""; - _e.label = 1; - case 1: - _e.trys.push([1, 6, 7, 12]); - _c = __asyncValues(client.addAll(globSource(path, globOptions), addOptions)); - _e.label = 2; - case 2: return [4 /*yield*/, _c.next()]; - case 3: - if (!(_d = _e.sent(), !_d.done)) return [3 /*break*/, 5]; - file = _d.value; - if (file.path.indexOf("/") === -1) { - rootCID = file.cid.toString(); - } - _e.label = 4; - case 4: return [3 /*break*/, 2]; - case 5: return [3 /*break*/, 12]; - case 6: - e_1_1 = _e.sent(); - e_1 = { error: e_1_1 }; - return [3 /*break*/, 12]; - case 7: - _e.trys.push([7, , 10, 11]); - if (!(_d && !_d.done && (_a = _c.return))) return [3 /*break*/, 9]; - return [4 /*yield*/, _a.call(_c)]; - case 8: - _e.sent(); - _e.label = 9; - case 9: return [3 /*break*/, 11]; - case 10: - if (e_1) throw e_1.error; - return [7 /*endfinally*/]; - case 11: return [7 /*endfinally*/]; - case 12: return [2 /*return*/, new core_js_1.Uri("ipfs/" + rootCID)]; - } - }); - }); - }; - return IPFSDeployer; -}()); -exports.default = new IPFSDeployer(); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ipfs/index.js.map b/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ipfs/index.js.map deleted file mode 100644 index 24142d2556..0000000000 --- a/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ipfs/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/defaults/deploy-modules/ipfs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,4CAAuC;AAEvC,yIAAyI;AACzI,IAAM,UAAU,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AACvC,IAAA,UAAU,GAAK,UAAU,WAAf,CAAgB;AAElC,IAAM,UAAU,GAAG,UAAC,GAAQ,IAAK,OAAA,GAAG,CAAC,SAAS,KAAK,IAAI,EAAtB,CAAsB,CAAC;AAExD;IAAA;IAkCA,CAAC;IAjCO,8BAAO,GAAb,UAAc,GAAQ,EAAE,MAA+B;;;;;;;;wBACrD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;4BACpB,MAAM,IAAI,KAAK,CACb,uCAAqC,GAAG,CAAC,QAAQ,EAAE,qEAAkE,CACtH,CAAC;yBACH;wBAEK,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;wBAEhB,OAAO,SAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,mCAAI,uBAAuB,CAAC;wBAExD,MAAM,GAAG,IAAI,UAAU,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;wBAC1C,WAAW,GAAG;4BAClB,SAAS,EAAE,IAAI;yBAChB,CAAC;wBAEI,UAAU,GAAG;4BACjB,iBAAiB,EAAE,KAAK;yBACzB,CAAC;wBAEE,OAAO,GAAG,EAAE,CAAC;;;;wBAEQ,KAAA,cAAA,MAAM,CAAC,MAAM,CACpC,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC,EAC7B,UAAU,CACX,CAAA;;;;;wBAHgB,IAAI,WAAA,CAAA;wBAInB,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;4BACjC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;yBAC/B;;;;;;;;;;;;;;;;;;;;6BAGH,sBAAO,IAAI,aAAG,CAAC,UAAQ,OAAS,CAAC,EAAC;;;;KACnC;IACH,mBAAC;AAAD,CAAC,AAlCD,IAkCC;AAED,kBAAe,IAAI,YAAY,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ipfs/web3api.deploy.ext.json b/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ipfs/web3api.deploy.ext.json deleted file mode 100644 index 49a29bc911..0000000000 --- a/packages/test-cases/cases/cli/api/run/.w3/web3api/deploy/modules/ipfs/web3api.deploy.ext.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "id": "DeployManifest_Deployer_WasmAsExt", - "type": "object", - "required": [ - "gatewayUri" - ], - "properties": { - "gatewayUri": { - "type": "string" - } - } -} \ No newline at end of file diff --git a/packages/test-cases/cases/cli/api/run/src/w3/Module/index.ts b/packages/test-cases/cases/cli/api/run/src/w3/Module/index.ts deleted file mode 100644 index 21a3fc94aa..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/Module/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { - Input_getData, - Input_setData, - Input_deployContract -} from "./serialization"; - -export { - Input_getData, - Input_setData, - Input_deployContract -}; diff --git a/packages/test-cases/cases/cli/api/run/src/w3/Module/serialization.ts b/packages/test-cases/cases/cli/api/run/src/w3/Module/serialization.ts deleted file mode 100644 index 7186f4523d..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/Module/serialization.ts +++ /dev/null @@ -1,193 +0,0 @@ -import { - Read, - ReadDecoder, - Write, - WriteSizer, - WriteEncoder, - Nullable, - BigInt, - BigNumber, - JSON, - Context -} from "@web3api/wasm-as"; -import * as Types from ".."; - -export class Input_getData { - address: string; - connection: Types.Ethereum_Connection | null; -} - -export function deserializegetDataArgs(argsBuf: ArrayBuffer): Input_getData { - const context: Context = new Context("Deserializing module-type: getData"); - const reader = new ReadDecoder(argsBuf, context); - let numFields = reader.readMapLength(); - - let _address: string = ""; - let _addressSet: bool = false; - let _connection: Types.Ethereum_Connection | null = null; - - while (numFields > 0) { - numFields--; - const field = reader.readString(); - - reader.context().push(field, "unknown", "searching for property type"); - if (field == "address") { - reader.context().push(field, "string", "type found, reading property"); - _address = reader.readString(); - _addressSet = true; - reader.context().pop(); - } - else if (field == "connection") { - reader.context().push(field, "Types.Ethereum_Connection | null", "type found, reading property"); - let object: Types.Ethereum_Connection | null = null; - if (!reader.isNextNil()) { - object = Types.Ethereum_Connection.read(reader); - } - _connection = object; - reader.context().pop(); - } - reader.context().pop(); - } - - if (!_addressSet) { - throw new Error(reader.context().printWithContext("Missing required argument: 'address: String'")); - } - - return { - address: _address, - connection: _connection - }; -} - -export function serializegetDataResult(result: u32): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) module-type: getData"); - const sizer = new WriteSizer(sizerContext); - writegetDataResult(sizer, result); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) module-type: getData"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writegetDataResult(encoder, result); - return buffer; -} - -export function writegetDataResult(writer: Write, result: u32): void { - writer.context().push("getData", "u32", "writing property"); - writer.writeUInt32(result); - writer.context().pop(); -} - -export class Input_setData { - options: Types.SetDataOptions; - connection: Types.Ethereum_Connection | null; -} - -export function deserializesetDataArgs(argsBuf: ArrayBuffer): Input_setData { - const context: Context = new Context("Deserializing module-type: setData"); - const reader = new ReadDecoder(argsBuf, context); - let numFields = reader.readMapLength(); - - let _options: Types.SetDataOptions | null = null; - let _optionsSet: bool = false; - let _connection: Types.Ethereum_Connection | null = null; - - while (numFields > 0) { - numFields--; - const field = reader.readString(); - - reader.context().push(field, "unknown", "searching for property type"); - if (field == "options") { - reader.context().push(field, "Types.SetDataOptions", "type found, reading property"); - const object = Types.SetDataOptions.read(reader); - _options = object; - _optionsSet = true; - reader.context().pop(); - } - else if (field == "connection") { - reader.context().push(field, "Types.Ethereum_Connection | null", "type found, reading property"); - let object: Types.Ethereum_Connection | null = null; - if (!reader.isNextNil()) { - object = Types.Ethereum_Connection.read(reader); - } - _connection = object; - reader.context().pop(); - } - reader.context().pop(); - } - - if (!_options || !_optionsSet) { - throw new Error(reader.context().printWithContext("Missing required argument: 'options: SetDataOptions'")); - } - - return { - options: _options, - connection: _connection - }; -} - -export function serializesetDataResult(result: Types.SetDataResult): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) module-type: setData"); - const sizer = new WriteSizer(sizerContext); - writesetDataResult(sizer, result); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) module-type: setData"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writesetDataResult(encoder, result); - return buffer; -} - -export function writesetDataResult(writer: Write, result: Types.SetDataResult): void { - writer.context().push("setData", "Types.SetDataResult", "writing property"); - Types.SetDataResult.write(writer, result); - writer.context().pop(); -} - -export class Input_deployContract { - connection: Types.Ethereum_Connection | null; -} - -export function deserializedeployContractArgs(argsBuf: ArrayBuffer): Input_deployContract { - const context: Context = new Context("Deserializing module-type: deployContract"); - const reader = new ReadDecoder(argsBuf, context); - let numFields = reader.readMapLength(); - - let _connection: Types.Ethereum_Connection | null = null; - - while (numFields > 0) { - numFields--; - const field = reader.readString(); - - reader.context().push(field, "unknown", "searching for property type"); - if (field == "connection") { - reader.context().push(field, "Types.Ethereum_Connection | null", "type found, reading property"); - let object: Types.Ethereum_Connection | null = null; - if (!reader.isNextNil()) { - object = Types.Ethereum_Connection.read(reader); - } - _connection = object; - reader.context().pop(); - } - reader.context().pop(); - } - - - return { - connection: _connection - }; -} - -export function serializedeployContractResult(result: string): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) module-type: deployContract"); - const sizer = new WriteSizer(sizerContext); - writedeployContractResult(sizer, result); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) module-type: deployContract"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writedeployContractResult(encoder, result); - return buffer; -} - -export function writedeployContractResult(writer: Write, result: string): void { - writer.context().push("deployContract", "string", "writing property"); - writer.writeString(result); - writer.context().pop(); -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/Module/wrapped.ts b/packages/test-cases/cases/cli/api/run/src/w3/Module/wrapped.ts deleted file mode 100644 index be0a48ae38..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/Module/wrapped.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { - getData, - setData, - deployContract -} from "../../index"; -import { - deserializegetDataArgs, - serializegetDataResult, - deserializesetDataArgs, - serializesetDataResult, - deserializedeployContractArgs, - serializedeployContractResult -} from "./serialization"; - -export function getDataWrapped(argsBuf: ArrayBuffer): ArrayBuffer { - const args = deserializegetDataArgs(argsBuf); - const result = getData({ - address: args.address, - connection: args.connection - }); - return serializegetDataResult(result); -} - -export function setDataWrapped(argsBuf: ArrayBuffer): ArrayBuffer { - const args = deserializesetDataArgs(argsBuf); - const result = setData({ - options: args.options, - connection: args.connection - }); - return serializesetDataResult(result); -} - -export function deployContractWrapped(argsBuf: ArrayBuffer): ArrayBuffer { - const args = deserializedeployContractArgs(argsBuf); - const result = deployContract({ - connection: args.connection - }); - return serializedeployContractResult(result); -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/SetDataOptions/index.ts b/packages/test-cases/cases/cli/api/run/src/w3/SetDataOptions/index.ts deleted file mode 100644 index ab18cadef7..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/SetDataOptions/index.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { - Read, - Write, - Nullable, - BigInt, - BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, -} from "@web3api/wasm-as"; -import { - serializeSetDataOptions, - deserializeSetDataOptions, - writeSetDataOptions, - readSetDataOptions -} from "./serialization"; -import * as Types from ".."; - -@serializable -export class SetDataOptions { - address: string; - value: u32; - - static toBuffer(type: SetDataOptions): ArrayBuffer { - return serializeSetDataOptions(type); - } - - static fromBuffer(buffer: ArrayBuffer): SetDataOptions { - return deserializeSetDataOptions(buffer); - } - - static write(writer: Write, type: SetDataOptions): void { - writeSetDataOptions(writer, type); - } - - static read(reader: Read): SetDataOptions { - return readSetDataOptions(reader); - } - - static toJson(type: SetDataOptions): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): SetDataOptions { - return (new JSONDeserializer(json)).decode(); - } -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/SetDataOptions/serialization.ts b/packages/test-cases/cases/cli/api/run/src/w3/SetDataOptions/serialization.ts deleted file mode 100644 index 1d7a60a1f0..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/SetDataOptions/serialization.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { - Read, - ReadDecoder, - Write, - WriteSizer, - WriteEncoder, - Nullable, - BigInt, - BigNumber, - JSON, - Context -} from "@web3api/wasm-as"; -import { SetDataOptions } from "./"; -import * as Types from ".."; - -export function serializeSetDataOptions(type: SetDataOptions): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) object-type: SetDataOptions"); - const sizer = new WriteSizer(sizerContext); - writeSetDataOptions(sizer, type); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) object-type: SetDataOptions"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeSetDataOptions(encoder, type); - return buffer; -} - -export function writeSetDataOptions(writer: Write, type: SetDataOptions): void { - writer.writeMapLength(2); - writer.context().push("address", "string", "writing property"); - writer.writeString("address"); - writer.writeString(type.address); - writer.context().pop(); - writer.context().push("value", "u32", "writing property"); - writer.writeString("value"); - writer.writeUInt32(type.value); - writer.context().pop(); -} - -export function deserializeSetDataOptions(buffer: ArrayBuffer): SetDataOptions { - const context: Context = new Context("Deserializing object-type SetDataOptions"); - const reader = new ReadDecoder(buffer, context); - return readSetDataOptions(reader); -} - -export function readSetDataOptions(reader: Read): SetDataOptions { - let numFields = reader.readMapLength(); - - let _address: string = ""; - let _addressSet: bool = false; - let _value: u32 = 0; - let _valueSet: bool = false; - - while (numFields > 0) { - numFields--; - const field = reader.readString(); - - reader.context().push(field, "unknown", "searching for property type"); - if (field == "address") { - reader.context().push(field, "string", "type found, reading property"); - _address = reader.readString(); - _addressSet = true; - reader.context().pop(); - } - else if (field == "value") { - reader.context().push(field, "u32", "type found, reading property"); - _value = reader.readUInt32(); - _valueSet = true; - reader.context().pop(); - } - reader.context().pop(); - } - - if (!_addressSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'address: String'")); - } - if (!_valueSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'value: UInt32'")); - } - - return { - address: _address, - value: _value - }; -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/SetDataResult/index.ts b/packages/test-cases/cases/cli/api/run/src/w3/SetDataResult/index.ts deleted file mode 100644 index e5783fa4a4..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/SetDataResult/index.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { - Read, - Write, - Nullable, - BigInt, - BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, -} from "@web3api/wasm-as"; -import { - serializeSetDataResult, - deserializeSetDataResult, - writeSetDataResult, - readSetDataResult -} from "./serialization"; -import * as Types from ".."; - -@serializable -export class SetDataResult { - txReceipt: string; - value: u32; - - static toBuffer(type: SetDataResult): ArrayBuffer { - return serializeSetDataResult(type); - } - - static fromBuffer(buffer: ArrayBuffer): SetDataResult { - return deserializeSetDataResult(buffer); - } - - static write(writer: Write, type: SetDataResult): void { - writeSetDataResult(writer, type); - } - - static read(reader: Read): SetDataResult { - return readSetDataResult(reader); - } - - static toJson(type: SetDataResult): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): SetDataResult { - return (new JSONDeserializer(json)).decode(); - } -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/SetDataResult/serialization.ts b/packages/test-cases/cases/cli/api/run/src/w3/SetDataResult/serialization.ts deleted file mode 100644 index 645a833a5a..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/SetDataResult/serialization.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { - Read, - ReadDecoder, - Write, - WriteSizer, - WriteEncoder, - Nullable, - BigInt, - BigNumber, - JSON, - Context -} from "@web3api/wasm-as"; -import { SetDataResult } from "./"; -import * as Types from ".."; - -export function serializeSetDataResult(type: SetDataResult): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) object-type: SetDataResult"); - const sizer = new WriteSizer(sizerContext); - writeSetDataResult(sizer, type); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) object-type: SetDataResult"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeSetDataResult(encoder, type); - return buffer; -} - -export function writeSetDataResult(writer: Write, type: SetDataResult): void { - writer.writeMapLength(2); - writer.context().push("txReceipt", "string", "writing property"); - writer.writeString("txReceipt"); - writer.writeString(type.txReceipt); - writer.context().pop(); - writer.context().push("value", "u32", "writing property"); - writer.writeString("value"); - writer.writeUInt32(type.value); - writer.context().pop(); -} - -export function deserializeSetDataResult(buffer: ArrayBuffer): SetDataResult { - const context: Context = new Context("Deserializing object-type SetDataResult"); - const reader = new ReadDecoder(buffer, context); - return readSetDataResult(reader); -} - -export function readSetDataResult(reader: Read): SetDataResult { - let numFields = reader.readMapLength(); - - let _txReceipt: string = ""; - let _txReceiptSet: bool = false; - let _value: u32 = 0; - let _valueSet: bool = false; - - while (numFields > 0) { - numFields--; - const field = reader.readString(); - - reader.context().push(field, "unknown", "searching for property type"); - if (field == "txReceipt") { - reader.context().push(field, "string", "type found, reading property"); - _txReceipt = reader.readString(); - _txReceiptSet = true; - reader.context().pop(); - } - else if (field == "value") { - reader.context().push(field, "u32", "type found, reading property"); - _value = reader.readUInt32(); - _valueSet = true; - reader.context().pop(); - } - reader.context().pop(); - } - - if (!_txReceiptSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'txReceipt: String'")); - } - if (!_valueSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'value: UInt32'")); - } - - return { - txReceipt: _txReceipt, - value: _value - }; -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/entry.ts b/packages/test-cases/cases/cli/api/run/src/w3/entry.ts deleted file mode 100644 index 448dd501ad..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/entry.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { - w3_invoke_args, - w3_invoke, - w3_load_env, - w3_sanitize_env, - w3_abort, - InvokeArgs -} from "@web3api/wasm-as"; - -import { - getDataWrapped, - setDataWrapped, - deployContractWrapped -} from "./Module/wrapped"; - -export function _w3_invoke(method_size: u32, args_size: u32): bool { - const args: InvokeArgs = w3_invoke_args( - method_size, - args_size - ); - - if (args.method == "getData") { - return w3_invoke(args, getDataWrapped); - } - else if (args.method == "setData") { - return w3_invoke(args, setDataWrapped); - } - else if (args.method == "deployContract") { - return w3_invoke(args, deployContractWrapped); - } - else { - return w3_invoke(args, null); - } -} - -export function w3Abort( - msg: string | null, - file: string | null, - line: u32, - column: u32 -): void { - w3_abort( - msg ? msg : "", - file ? file : "", - line, - column - ); -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Access/index.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Access/index.ts deleted file mode 100644 index a8ce73f608..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Access/index.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { - Read, - Write, - Nullable, - BigInt, - BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, -} from "@web3api/wasm-as"; -import { - serializeEthereum_Access, - deserializeEthereum_Access, - writeEthereum_Access, - readEthereum_Access -} from "./serialization"; -import * as Types from "../.."; - -@serializable -export class Ethereum_Access { - - public static uri: string = "w3://ens/ethereum.web3api.eth"; - - address: string; - storageKeys: Array; - - static toBuffer(type: Ethereum_Access): ArrayBuffer { - return serializeEthereum_Access(type); - } - - static fromBuffer(buffer: ArrayBuffer): Ethereum_Access { - return deserializeEthereum_Access(buffer); - } - - static write(writer: Write, type: Ethereum_Access): void { - writeEthereum_Access(writer, type); - } - - static read(reader: Read): Ethereum_Access { - return readEthereum_Access(reader); - } - - static toJson(type: Ethereum_Access): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): Ethereum_Access { - return (new JSONDeserializer(json)).decode(); - } -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Access/serialization.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Access/serialization.ts deleted file mode 100644 index 517e8689a9..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Access/serialization.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { - Read, - ReadDecoder, - Write, - WriteSizer, - WriteEncoder, - Nullable, - BigInt, - BigNumber, - JSON, - Context -} from "@web3api/wasm-as"; -import { Ethereum_Access } from "./"; -import * as Types from "../.."; - -export function serializeEthereum_Access(type: Ethereum_Access): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported object-type: Ethereum_Access"); - const sizer = new WriteSizer(sizerContext); - writeEthereum_Access(sizer, type); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) import object-type: Ethereum_Access"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeEthereum_Access(encoder, type); - return buffer; -} - -export function writeEthereum_Access(writer: Write, type: Ethereum_Access): void { - writer.writeMapLength(2); - writer.context().push("address", "string", "writing property"); - writer.writeString("address"); - writer.writeString(type.address); - writer.context().pop(); - writer.context().push("storageKeys", "Array", "writing property"); - writer.writeString("storageKeys"); - writer.writeArray(type.storageKeys, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); -} - -export function deserializeEthereum_Access(buffer: ArrayBuffer): Ethereum_Access { - const context: Context = new Context("Deserializing imported object-type Ethereum_Access"); - const reader = new ReadDecoder(buffer, context); - return readEthereum_Access(reader); -} - -export function readEthereum_Access(reader: Read): Ethereum_Access { - let numFields = reader.readMapLength(); - - let _address: string = ""; - let _addressSet: bool = false; - let _storageKeys: Array = []; - let _storageKeysSet: bool = false; - - while (numFields > 0) { - numFields--; - const field = reader.readString(); - - reader.context().push(field, "unknown", "searching for property type"); - if (field == "address") { - reader.context().push(field, "string", "type found, reading property"); - _address = reader.readString(); - _addressSet = true; - reader.context().pop(); - } - else if (field == "storageKeys") { - reader.context().push(field, "Array", "type found, reading property"); - _storageKeys = reader.readArray((reader: Read): string => { - return reader.readString(); - }); - _storageKeysSet = true; - reader.context().pop(); - } - reader.context().pop(); - } - - if (!_addressSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'address: String'")); - } - if (!_storageKeysSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'storageKeys: [String]'")); - } - - return { - address: _address, - storageKeys: _storageKeys - }; -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Connection/index.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Connection/index.ts deleted file mode 100644 index 7122036945..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Connection/index.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { - Read, - Write, - Nullable, - BigInt, - BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, -} from "@web3api/wasm-as"; -import { - serializeEthereum_Connection, - deserializeEthereum_Connection, - writeEthereum_Connection, - readEthereum_Connection -} from "./serialization"; -import * as Types from "../.."; - -@serializable -export class Ethereum_Connection { - - public static uri: string = "w3://ens/ethereum.web3api.eth"; - - node: string | null; - networkNameOrChainId: string | null; - - static toBuffer(type: Ethereum_Connection): ArrayBuffer { - return serializeEthereum_Connection(type); - } - - static fromBuffer(buffer: ArrayBuffer): Ethereum_Connection { - return deserializeEthereum_Connection(buffer); - } - - static write(writer: Write, type: Ethereum_Connection): void { - writeEthereum_Connection(writer, type); - } - - static read(reader: Read): Ethereum_Connection { - return readEthereum_Connection(reader); - } - - static toJson(type: Ethereum_Connection): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): Ethereum_Connection { - return (new JSONDeserializer(json)).decode(); - } -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Connection/serialization.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Connection/serialization.ts deleted file mode 100644 index 13f105e98e..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Connection/serialization.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { - Read, - ReadDecoder, - Write, - WriteSizer, - WriteEncoder, - Nullable, - BigInt, - BigNumber, - JSON, - Context -} from "@web3api/wasm-as"; -import { Ethereum_Connection } from "./"; -import * as Types from "../.."; - -export function serializeEthereum_Connection(type: Ethereum_Connection): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported object-type: Ethereum_Connection"); - const sizer = new WriteSizer(sizerContext); - writeEthereum_Connection(sizer, type); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) import object-type: Ethereum_Connection"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeEthereum_Connection(encoder, type); - return buffer; -} - -export function writeEthereum_Connection(writer: Write, type: Ethereum_Connection): void { - writer.writeMapLength(2); - writer.context().push("node", "string | null", "writing property"); - writer.writeString("node"); - writer.writeNullableString(type.node); - writer.context().pop(); - writer.context().push("networkNameOrChainId", "string | null", "writing property"); - writer.writeString("networkNameOrChainId"); - writer.writeNullableString(type.networkNameOrChainId); - writer.context().pop(); -} - -export function deserializeEthereum_Connection(buffer: ArrayBuffer): Ethereum_Connection { - const context: Context = new Context("Deserializing imported object-type Ethereum_Connection"); - const reader = new ReadDecoder(buffer, context); - return readEthereum_Connection(reader); -} - -export function readEthereum_Connection(reader: Read): Ethereum_Connection { - let numFields = reader.readMapLength(); - - let _node: string | null = null; - let _networkNameOrChainId: string | null = null; - - while (numFields > 0) { - numFields--; - const field = reader.readString(); - - reader.context().push(field, "unknown", "searching for property type"); - if (field == "node") { - reader.context().push(field, "string | null", "type found, reading property"); - _node = reader.readNullableString(); - reader.context().pop(); - } - else if (field == "networkNameOrChainId") { - reader.context().push(field, "string | null", "type found, reading property"); - _networkNameOrChainId = reader.readNullableString(); - reader.context().pop(); - } - reader.context().pop(); - } - - - return { - node: _node, - networkNameOrChainId: _networkNameOrChainId - }; -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_EventNotification/index.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_EventNotification/index.ts deleted file mode 100644 index fb40929eef..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_EventNotification/index.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - Read, - Write, - Nullable, - BigInt, - BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, -} from "@web3api/wasm-as"; -import { - serializeEthereum_EventNotification, - deserializeEthereum_EventNotification, - writeEthereum_EventNotification, - readEthereum_EventNotification -} from "./serialization"; -import * as Types from "../.."; - -@serializable -export class Ethereum_EventNotification { - - public static uri: string = "w3://ens/ethereum.web3api.eth"; - - data: string; - address: string; - log: Types.Ethereum_Log; - - static toBuffer(type: Ethereum_EventNotification): ArrayBuffer { - return serializeEthereum_EventNotification(type); - } - - static fromBuffer(buffer: ArrayBuffer): Ethereum_EventNotification { - return deserializeEthereum_EventNotification(buffer); - } - - static write(writer: Write, type: Ethereum_EventNotification): void { - writeEthereum_EventNotification(writer, type); - } - - static read(reader: Read): Ethereum_EventNotification { - return readEthereum_EventNotification(reader); - } - - static toJson(type: Ethereum_EventNotification): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): Ethereum_EventNotification { - return (new JSONDeserializer(json)).decode(); - } -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_EventNotification/serialization.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_EventNotification/serialization.ts deleted file mode 100644 index 819a4a7529..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_EventNotification/serialization.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { - Read, - ReadDecoder, - Write, - WriteSizer, - WriteEncoder, - Nullable, - BigInt, - BigNumber, - JSON, - Context -} from "@web3api/wasm-as"; -import { Ethereum_EventNotification } from "./"; -import * as Types from "../.."; - -export function serializeEthereum_EventNotification(type: Ethereum_EventNotification): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported object-type: Ethereum_EventNotification"); - const sizer = new WriteSizer(sizerContext); - writeEthereum_EventNotification(sizer, type); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) import object-type: Ethereum_EventNotification"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeEthereum_EventNotification(encoder, type); - return buffer; -} - -export function writeEthereum_EventNotification(writer: Write, type: Ethereum_EventNotification): void { - writer.writeMapLength(3); - writer.context().push("data", "string", "writing property"); - writer.writeString("data"); - writer.writeString(type.data); - writer.context().pop(); - writer.context().push("address", "string", "writing property"); - writer.writeString("address"); - writer.writeString(type.address); - writer.context().pop(); - writer.context().push("log", "Types.Ethereum_Log", "writing property"); - writer.writeString("log"); - Types.Ethereum_Log.write(writer, type.log); - writer.context().pop(); -} - -export function deserializeEthereum_EventNotification(buffer: ArrayBuffer): Ethereum_EventNotification { - const context: Context = new Context("Deserializing imported object-type Ethereum_EventNotification"); - const reader = new ReadDecoder(buffer, context); - return readEthereum_EventNotification(reader); -} - -export function readEthereum_EventNotification(reader: Read): Ethereum_EventNotification { - let numFields = reader.readMapLength(); - - let _data: string = ""; - let _dataSet: bool = false; - let _address: string = ""; - let _addressSet: bool = false; - let _log: Types.Ethereum_Log | null = null; - let _logSet: bool = false; - - while (numFields > 0) { - numFields--; - const field = reader.readString(); - - reader.context().push(field, "unknown", "searching for property type"); - if (field == "data") { - reader.context().push(field, "string", "type found, reading property"); - _data = reader.readString(); - _dataSet = true; - reader.context().pop(); - } - else if (field == "address") { - reader.context().push(field, "string", "type found, reading property"); - _address = reader.readString(); - _addressSet = true; - reader.context().pop(); - } - else if (field == "log") { - reader.context().push(field, "Types.Ethereum_Log", "type found, reading property"); - const object = Types.Ethereum_Log.read(reader); - _log = object; - _logSet = true; - reader.context().pop(); - } - reader.context().pop(); - } - - if (!_dataSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'data: String'")); - } - if (!_addressSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'address: String'")); - } - if (!_log || !_logSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'log: Ethereum_Log'")); - } - - return { - data: _data, - address: _address, - log: _log - }; -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Log/index.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Log/index.ts deleted file mode 100644 index 64a01f2025..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Log/index.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { - Read, - Write, - Nullable, - BigInt, - BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, -} from "@web3api/wasm-as"; -import { - serializeEthereum_Log, - deserializeEthereum_Log, - writeEthereum_Log, - readEthereum_Log -} from "./serialization"; -import * as Types from "../.."; - -@serializable -export class Ethereum_Log { - - public static uri: string = "w3://ens/ethereum.web3api.eth"; - - blockNumber: BigInt; - blockHash: string; - transactionIndex: u32; - removed: bool; - address: string; - data: string; - topics: Array; - transactionHash: string; - logIndex: u32; - - static toBuffer(type: Ethereum_Log): ArrayBuffer { - return serializeEthereum_Log(type); - } - - static fromBuffer(buffer: ArrayBuffer): Ethereum_Log { - return deserializeEthereum_Log(buffer); - } - - static write(writer: Write, type: Ethereum_Log): void { - writeEthereum_Log(writer, type); - } - - static read(reader: Read): Ethereum_Log { - return readEthereum_Log(reader); - } - - static toJson(type: Ethereum_Log): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): Ethereum_Log { - return (new JSONDeserializer(json)).decode(); - } -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Log/serialization.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Log/serialization.ts deleted file mode 100644 index a6f4119db9..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Log/serialization.ts +++ /dev/null @@ -1,200 +0,0 @@ -import { - Read, - ReadDecoder, - Write, - WriteSizer, - WriteEncoder, - Nullable, - BigInt, - BigNumber, - JSON, - Context -} from "@web3api/wasm-as"; -import { Ethereum_Log } from "./"; -import * as Types from "../.."; - -export function serializeEthereum_Log(type: Ethereum_Log): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported object-type: Ethereum_Log"); - const sizer = new WriteSizer(sizerContext); - writeEthereum_Log(sizer, type); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) import object-type: Ethereum_Log"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeEthereum_Log(encoder, type); - return buffer; -} - -export function writeEthereum_Log(writer: Write, type: Ethereum_Log): void { - writer.writeMapLength(9); - writer.context().push("blockNumber", "BigInt", "writing property"); - writer.writeString("blockNumber"); - writer.writeBigInt(type.blockNumber); - writer.context().pop(); - writer.context().push("blockHash", "string", "writing property"); - writer.writeString("blockHash"); - writer.writeString(type.blockHash); - writer.context().pop(); - writer.context().push("transactionIndex", "u32", "writing property"); - writer.writeString("transactionIndex"); - writer.writeUInt32(type.transactionIndex); - writer.context().pop(); - writer.context().push("removed", "bool", "writing property"); - writer.writeString("removed"); - writer.writeBool(type.removed); - writer.context().pop(); - writer.context().push("address", "string", "writing property"); - writer.writeString("address"); - writer.writeString(type.address); - writer.context().pop(); - writer.context().push("data", "string", "writing property"); - writer.writeString("data"); - writer.writeString(type.data); - writer.context().pop(); - writer.context().push("topics", "Array", "writing property"); - writer.writeString("topics"); - writer.writeArray(type.topics, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); - writer.context().push("transactionHash", "string", "writing property"); - writer.writeString("transactionHash"); - writer.writeString(type.transactionHash); - writer.context().pop(); - writer.context().push("logIndex", "u32", "writing property"); - writer.writeString("logIndex"); - writer.writeUInt32(type.logIndex); - writer.context().pop(); -} - -export function deserializeEthereum_Log(buffer: ArrayBuffer): Ethereum_Log { - const context: Context = new Context("Deserializing imported object-type Ethereum_Log"); - const reader = new ReadDecoder(buffer, context); - return readEthereum_Log(reader); -} - -export function readEthereum_Log(reader: Read): Ethereum_Log { - let numFields = reader.readMapLength(); - - let _blockNumber: BigInt = BigInt.fromUInt16(0); - let _blockNumberSet: bool = false; - let _blockHash: string = ""; - let _blockHashSet: bool = false; - let _transactionIndex: u32 = 0; - let _transactionIndexSet: bool = false; - let _removed: bool = false; - let _removedSet: bool = false; - let _address: string = ""; - let _addressSet: bool = false; - let _data: string = ""; - let _dataSet: bool = false; - let _topics: Array = []; - let _topicsSet: bool = false; - let _transactionHash: string = ""; - let _transactionHashSet: bool = false; - let _logIndex: u32 = 0; - let _logIndexSet: bool = false; - - while (numFields > 0) { - numFields--; - const field = reader.readString(); - - reader.context().push(field, "unknown", "searching for property type"); - if (field == "blockNumber") { - reader.context().push(field, "BigInt", "type found, reading property"); - _blockNumber = reader.readBigInt(); - _blockNumberSet = true; - reader.context().pop(); - } - else if (field == "blockHash") { - reader.context().push(field, "string", "type found, reading property"); - _blockHash = reader.readString(); - _blockHashSet = true; - reader.context().pop(); - } - else if (field == "transactionIndex") { - reader.context().push(field, "u32", "type found, reading property"); - _transactionIndex = reader.readUInt32(); - _transactionIndexSet = true; - reader.context().pop(); - } - else if (field == "removed") { - reader.context().push(field, "bool", "type found, reading property"); - _removed = reader.readBool(); - _removedSet = true; - reader.context().pop(); - } - else if (field == "address") { - reader.context().push(field, "string", "type found, reading property"); - _address = reader.readString(); - _addressSet = true; - reader.context().pop(); - } - else if (field == "data") { - reader.context().push(field, "string", "type found, reading property"); - _data = reader.readString(); - _dataSet = true; - reader.context().pop(); - } - else if (field == "topics") { - reader.context().push(field, "Array", "type found, reading property"); - _topics = reader.readArray((reader: Read): string => { - return reader.readString(); - }); - _topicsSet = true; - reader.context().pop(); - } - else if (field == "transactionHash") { - reader.context().push(field, "string", "type found, reading property"); - _transactionHash = reader.readString(); - _transactionHashSet = true; - reader.context().pop(); - } - else if (field == "logIndex") { - reader.context().push(field, "u32", "type found, reading property"); - _logIndex = reader.readUInt32(); - _logIndexSet = true; - reader.context().pop(); - } - reader.context().pop(); - } - - if (!_blockNumberSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'blockNumber: BigInt'")); - } - if (!_blockHashSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'blockHash: String'")); - } - if (!_transactionIndexSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'transactionIndex: UInt32'")); - } - if (!_removedSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'removed: Boolean'")); - } - if (!_addressSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'address: String'")); - } - if (!_dataSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'data: String'")); - } - if (!_topicsSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'topics: [String]'")); - } - if (!_transactionHashSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'transactionHash: String'")); - } - if (!_logIndexSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'logIndex: UInt32'")); - } - - return { - blockNumber: _blockNumber, - blockHash: _blockHash, - transactionIndex: _transactionIndex, - removed: _removed, - address: _address, - data: _data, - topics: _topics, - transactionHash: _transactionHash, - logIndex: _logIndex - }; -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Module/index.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Module/index.ts deleted file mode 100644 index aebc063bd3..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Module/index.ts +++ /dev/null @@ -1,665 +0,0 @@ -import { - w3_subinvoke, - w3_subinvokeImplementation, - Nullable, - BigInt, - BigNumber, - JSON, - Result -} from "@web3api/wasm-as"; -import { - serializecallContractViewArgs, - deserializecallContractViewResult, - Input_callContractView, - serializecallContractStaticArgs, - deserializecallContractStaticResult, - Input_callContractStatic, - serializegetBalanceArgs, - deserializegetBalanceResult, - Input_getBalance, - serializeencodeParamsArgs, - deserializeencodeParamsResult, - Input_encodeParams, - serializeencodeFunctionArgs, - deserializeencodeFunctionResult, - Input_encodeFunction, - serializesolidityPackArgs, - deserializesolidityPackResult, - Input_solidityPack, - serializesolidityKeccak256Args, - deserializesolidityKeccak256Result, - Input_solidityKeccak256, - serializesoliditySha256Args, - deserializesoliditySha256Result, - Input_soliditySha256, - serializegetSignerAddressArgs, - deserializegetSignerAddressResult, - Input_getSignerAddress, - serializegetSignerBalanceArgs, - deserializegetSignerBalanceResult, - Input_getSignerBalance, - serializegetSignerTransactionCountArgs, - deserializegetSignerTransactionCountResult, - Input_getSignerTransactionCount, - serializegetGasPriceArgs, - deserializegetGasPriceResult, - Input_getGasPrice, - serializeestimateTransactionGasArgs, - deserializeestimateTransactionGasResult, - Input_estimateTransactionGas, - serializeestimateContractCallGasArgs, - deserializeestimateContractCallGasResult, - Input_estimateContractCallGas, - serializecheckAddressArgs, - deserializecheckAddressResult, - Input_checkAddress, - serializetoWeiArgs, - deserializetoWeiResult, - Input_toWei, - serializetoEthArgs, - deserializetoEthResult, - Input_toEth, - serializeawaitTransactionArgs, - deserializeawaitTransactionResult, - Input_awaitTransaction, - serializewaitForEventArgs, - deserializewaitForEventResult, - Input_waitForEvent, - serializegetNetworkArgs, - deserializegetNetworkResult, - Input_getNetwork, - serializecallContractMethodArgs, - deserializecallContractMethodResult, - Input_callContractMethod, - serializecallContractMethodAndWaitArgs, - deserializecallContractMethodAndWaitResult, - Input_callContractMethodAndWait, - serializesendTransactionArgs, - deserializesendTransactionResult, - Input_sendTransaction, - serializesendTransactionAndWaitArgs, - deserializesendTransactionAndWaitResult, - Input_sendTransactionAndWait, - serializedeployContractArgs, - deserializedeployContractResult, - Input_deployContract, - serializesignMessageArgs, - deserializesignMessageResult, - Input_signMessage, - serializesendRPCArgs, - deserializesendRPCResult, - Input_sendRPC -} from "./serialization"; -import * as Types from "../.."; - -export class Ethereum_Module { - - public static uri: string = "w3://ens/ethereum.web3api.eth"; - - public static callContractView( - input: Input_callContractView - ): Result { - const args = serializecallContractViewArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "callContractView", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializecallContractViewResult(result.unwrap()) - ); - } - - public static callContractStatic( - input: Input_callContractStatic - ): Result { - const args = serializecallContractStaticArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "callContractStatic", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializecallContractStaticResult(result.unwrap()) - ); - } - - public static getBalance( - input: Input_getBalance - ): Result { - const args = serializegetBalanceArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "getBalance", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializegetBalanceResult(result.unwrap()) - ); - } - - public static encodeParams( - input: Input_encodeParams - ): Result { - const args = serializeencodeParamsArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "encodeParams", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializeencodeParamsResult(result.unwrap()) - ); - } - - public static encodeFunction( - input: Input_encodeFunction - ): Result { - const args = serializeencodeFunctionArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "encodeFunction", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializeencodeFunctionResult(result.unwrap()) - ); - } - - public static solidityPack( - input: Input_solidityPack - ): Result { - const args = serializesolidityPackArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "solidityPack", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializesolidityPackResult(result.unwrap()) - ); - } - - public static solidityKeccak256( - input: Input_solidityKeccak256 - ): Result { - const args = serializesolidityKeccak256Args(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "solidityKeccak256", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializesolidityKeccak256Result(result.unwrap()) - ); - } - - public static soliditySha256( - input: Input_soliditySha256 - ): Result { - const args = serializesoliditySha256Args(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "soliditySha256", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializesoliditySha256Result(result.unwrap()) - ); - } - - public static getSignerAddress( - input: Input_getSignerAddress - ): Result { - const args = serializegetSignerAddressArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "getSignerAddress", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializegetSignerAddressResult(result.unwrap()) - ); - } - - public static getSignerBalance( - input: Input_getSignerBalance - ): Result { - const args = serializegetSignerBalanceArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "getSignerBalance", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializegetSignerBalanceResult(result.unwrap()) - ); - } - - public static getSignerTransactionCount( - input: Input_getSignerTransactionCount - ): Result { - const args = serializegetSignerTransactionCountArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "getSignerTransactionCount", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializegetSignerTransactionCountResult(result.unwrap()) - ); - } - - public static getGasPrice( - input: Input_getGasPrice - ): Result { - const args = serializegetGasPriceArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "getGasPrice", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializegetGasPriceResult(result.unwrap()) - ); - } - - public static estimateTransactionGas( - input: Input_estimateTransactionGas - ): Result { - const args = serializeestimateTransactionGasArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "estimateTransactionGas", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializeestimateTransactionGasResult(result.unwrap()) - ); - } - - public static estimateContractCallGas( - input: Input_estimateContractCallGas - ): Result { - const args = serializeestimateContractCallGasArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "estimateContractCallGas", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializeestimateContractCallGasResult(result.unwrap()) - ); - } - - public static checkAddress( - input: Input_checkAddress - ): Result { - const args = serializecheckAddressArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "checkAddress", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializecheckAddressResult(result.unwrap()) - ); - } - - public static toWei( - input: Input_toWei - ): Result { - const args = serializetoWeiArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "toWei", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializetoWeiResult(result.unwrap()) - ); - } - - public static toEth( - input: Input_toEth - ): Result { - const args = serializetoEthArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "toEth", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializetoEthResult(result.unwrap()) - ); - } - - public static awaitTransaction( - input: Input_awaitTransaction - ): Result { - const args = serializeawaitTransactionArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "awaitTransaction", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializeawaitTransactionResult(result.unwrap()) - ); - } - - public static waitForEvent( - input: Input_waitForEvent - ): Result { - const args = serializewaitForEventArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "waitForEvent", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializewaitForEventResult(result.unwrap()) - ); - } - - public static getNetwork( - input: Input_getNetwork - ): Result { - const args = serializegetNetworkArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "getNetwork", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializegetNetworkResult(result.unwrap()) - ); - } - - public static callContractMethod( - input: Input_callContractMethod - ): Result { - const args = serializecallContractMethodArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "callContractMethod", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializecallContractMethodResult(result.unwrap()) - ); - } - - public static callContractMethodAndWait( - input: Input_callContractMethodAndWait - ): Result { - const args = serializecallContractMethodAndWaitArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "callContractMethodAndWait", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializecallContractMethodAndWaitResult(result.unwrap()) - ); - } - - public static sendTransaction( - input: Input_sendTransaction - ): Result { - const args = serializesendTransactionArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "sendTransaction", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializesendTransactionResult(result.unwrap()) - ); - } - - public static sendTransactionAndWait( - input: Input_sendTransactionAndWait - ): Result { - const args = serializesendTransactionAndWaitArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "sendTransactionAndWait", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializesendTransactionAndWaitResult(result.unwrap()) - ); - } - - public static deployContract( - input: Input_deployContract - ): Result { - const args = serializedeployContractArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "deployContract", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializedeployContractResult(result.unwrap()) - ); - } - - public static signMessage( - input: Input_signMessage - ): Result { - const args = serializesignMessageArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "signMessage", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializesignMessageResult(result.unwrap()) - ); - } - - public static sendRPC( - input: Input_sendRPC - ): Result { - const args = serializesendRPCArgs(input); - const result = w3_subinvoke( - "w3://ens/ethereum.web3api.eth", - "sendRPC", - args - ); - - if (result.isErr) { - return Result.Err( - result.unwrapErr() - ); - } - - return Result.Ok( - deserializesendRPCResult(result.unwrap()) - ); - } -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Module/serialization.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Module/serialization.ts deleted file mode 100644 index b845164944..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Module/serialization.ts +++ /dev/null @@ -1,1366 +0,0 @@ -import { - Read, - ReadDecoder, - Write, - WriteSizer, - WriteEncoder, - Nullable, - BigInt, - BigNumber, - JSON, - Context -} from "@web3api/wasm-as"; -import * as Types from "../.."; - -export class Input_callContractView { - address: string; - method: string; - args: Array | null; - connection: Types.Ethereum_Connection | null; -} - -export function serializecallContractViewArgs(input: Input_callContractView): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: callContractView"); - const sizer = new WriteSizer(sizerContext); - writecallContractViewArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: callContractView"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writecallContractViewArgs(encoder, input); - return buffer; -} - -export function writecallContractViewArgs( - writer: Write, - input: Input_callContractView -): void { - writer.writeMapLength(4); - writer.context().push("address", "string", "writing property"); - writer.writeString("address"); - writer.writeString(input.address); - writer.context().pop(); - writer.context().push("method", "string", "writing property"); - writer.writeString("method"); - writer.writeString(input.method); - writer.context().pop(); - writer.context().push("args", "Array | null", "writing property"); - writer.writeString("args"); - writer.writeNullableArray(input.args, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializecallContractViewResult(buffer: ArrayBuffer): string { - const context: Context = new Context("Deserializing imported module-type: callContractView"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("callContractView", "string", "reading function output"); - const res: string = reader.readString(); - reader.context().pop(); - - return res; -} - -export class Input_callContractStatic { - address: string; - method: string; - args: Array | null; - connection: Types.Ethereum_Connection | null; - txOverrides: Types.Ethereum_TxOverrides | null; -} - -export function serializecallContractStaticArgs(input: Input_callContractStatic): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: callContractStatic"); - const sizer = new WriteSizer(sizerContext); - writecallContractStaticArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: callContractStatic"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writecallContractStaticArgs(encoder, input); - return buffer; -} - -export function writecallContractStaticArgs( - writer: Write, - input: Input_callContractStatic -): void { - writer.writeMapLength(5); - writer.context().push("address", "string", "writing property"); - writer.writeString("address"); - writer.writeString(input.address); - writer.context().pop(); - writer.context().push("method", "string", "writing property"); - writer.writeString("method"); - writer.writeString(input.method); - writer.context().pop(); - writer.context().push("args", "Array | null", "writing property"); - writer.writeString("args"); - writer.writeNullableArray(input.args, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); - writer.context().push("txOverrides", "Types.Ethereum_TxOverrides | null", "writing property"); - writer.writeString("txOverrides"); - if (input.txOverrides) { - Types.Ethereum_TxOverrides.write(writer, input.txOverrides as Types.Ethereum_TxOverrides); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializecallContractStaticResult(buffer: ArrayBuffer): Types.Ethereum_StaticTxResult { - const context: Context = new Context("Deserializing imported module-type: callContractStatic"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("callContractStatic", "Types.Ethereum_StaticTxResult", "reading function output"); - const object = Types.Ethereum_StaticTxResult.read(reader); - const res: Types.Ethereum_StaticTxResult = object; - reader.context().pop(); - - return res; -} - -export class Input_getBalance { - address: string; - blockTag: BigInt | null; - connection: Types.Ethereum_Connection | null; -} - -export function serializegetBalanceArgs(input: Input_getBalance): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: getBalance"); - const sizer = new WriteSizer(sizerContext); - writegetBalanceArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: getBalance"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writegetBalanceArgs(encoder, input); - return buffer; -} - -export function writegetBalanceArgs( - writer: Write, - input: Input_getBalance -): void { - writer.writeMapLength(3); - writer.context().push("address", "string", "writing property"); - writer.writeString("address"); - writer.writeString(input.address); - writer.context().pop(); - writer.context().push("blockTag", "BigInt | null", "writing property"); - writer.writeString("blockTag"); - writer.writeNullableBigInt(input.blockTag); - writer.context().pop(); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializegetBalanceResult(buffer: ArrayBuffer): BigInt { - const context: Context = new Context("Deserializing imported module-type: getBalance"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("getBalance", "BigInt", "reading function output"); - const res: BigInt = reader.readBigInt(); - reader.context().pop(); - - return res; -} - -export class Input_encodeParams { - types: Array; - values: Array; -} - -export function serializeencodeParamsArgs(input: Input_encodeParams): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: encodeParams"); - const sizer = new WriteSizer(sizerContext); - writeencodeParamsArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: encodeParams"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeencodeParamsArgs(encoder, input); - return buffer; -} - -export function writeencodeParamsArgs( - writer: Write, - input: Input_encodeParams -): void { - writer.writeMapLength(2); - writer.context().push("types", "Array", "writing property"); - writer.writeString("types"); - writer.writeArray(input.types, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); - writer.context().push("values", "Array", "writing property"); - writer.writeString("values"); - writer.writeArray(input.values, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); -} - -export function deserializeencodeParamsResult(buffer: ArrayBuffer): string { - const context: Context = new Context("Deserializing imported module-type: encodeParams"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("encodeParams", "string", "reading function output"); - const res: string = reader.readString(); - reader.context().pop(); - - return res; -} - -export class Input_encodeFunction { - method: string; - args: Array | null; -} - -export function serializeencodeFunctionArgs(input: Input_encodeFunction): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: encodeFunction"); - const sizer = new WriteSizer(sizerContext); - writeencodeFunctionArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: encodeFunction"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeencodeFunctionArgs(encoder, input); - return buffer; -} - -export function writeencodeFunctionArgs( - writer: Write, - input: Input_encodeFunction -): void { - writer.writeMapLength(2); - writer.context().push("method", "string", "writing property"); - writer.writeString("method"); - writer.writeString(input.method); - writer.context().pop(); - writer.context().push("args", "Array | null", "writing property"); - writer.writeString("args"); - writer.writeNullableArray(input.args, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); -} - -export function deserializeencodeFunctionResult(buffer: ArrayBuffer): string { - const context: Context = new Context("Deserializing imported module-type: encodeFunction"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("encodeFunction", "string", "reading function output"); - const res: string = reader.readString(); - reader.context().pop(); - - return res; -} - -export class Input_solidityPack { - types: Array; - values: Array; -} - -export function serializesolidityPackArgs(input: Input_solidityPack): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: solidityPack"); - const sizer = new WriteSizer(sizerContext); - writesolidityPackArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: solidityPack"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writesolidityPackArgs(encoder, input); - return buffer; -} - -export function writesolidityPackArgs( - writer: Write, - input: Input_solidityPack -): void { - writer.writeMapLength(2); - writer.context().push("types", "Array", "writing property"); - writer.writeString("types"); - writer.writeArray(input.types, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); - writer.context().push("values", "Array", "writing property"); - writer.writeString("values"); - writer.writeArray(input.values, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); -} - -export function deserializesolidityPackResult(buffer: ArrayBuffer): string { - const context: Context = new Context("Deserializing imported module-type: solidityPack"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("solidityPack", "string", "reading function output"); - const res: string = reader.readString(); - reader.context().pop(); - - return res; -} - -export class Input_solidityKeccak256 { - types: Array; - values: Array; -} - -export function serializesolidityKeccak256Args(input: Input_solidityKeccak256): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: solidityKeccak256"); - const sizer = new WriteSizer(sizerContext); - writesolidityKeccak256Args(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: solidityKeccak256"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writesolidityKeccak256Args(encoder, input); - return buffer; -} - -export function writesolidityKeccak256Args( - writer: Write, - input: Input_solidityKeccak256 -): void { - writer.writeMapLength(2); - writer.context().push("types", "Array", "writing property"); - writer.writeString("types"); - writer.writeArray(input.types, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); - writer.context().push("values", "Array", "writing property"); - writer.writeString("values"); - writer.writeArray(input.values, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); -} - -export function deserializesolidityKeccak256Result(buffer: ArrayBuffer): string { - const context: Context = new Context("Deserializing imported module-type: solidityKeccak256"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("solidityKeccak256", "string", "reading function output"); - const res: string = reader.readString(); - reader.context().pop(); - - return res; -} - -export class Input_soliditySha256 { - types: Array; - values: Array; -} - -export function serializesoliditySha256Args(input: Input_soliditySha256): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: soliditySha256"); - const sizer = new WriteSizer(sizerContext); - writesoliditySha256Args(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: soliditySha256"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writesoliditySha256Args(encoder, input); - return buffer; -} - -export function writesoliditySha256Args( - writer: Write, - input: Input_soliditySha256 -): void { - writer.writeMapLength(2); - writer.context().push("types", "Array", "writing property"); - writer.writeString("types"); - writer.writeArray(input.types, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); - writer.context().push("values", "Array", "writing property"); - writer.writeString("values"); - writer.writeArray(input.values, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); -} - -export function deserializesoliditySha256Result(buffer: ArrayBuffer): string { - const context: Context = new Context("Deserializing imported module-type: soliditySha256"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("soliditySha256", "string", "reading function output"); - const res: string = reader.readString(); - reader.context().pop(); - - return res; -} - -export class Input_getSignerAddress { - connection: Types.Ethereum_Connection | null; -} - -export function serializegetSignerAddressArgs(input: Input_getSignerAddress): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: getSignerAddress"); - const sizer = new WriteSizer(sizerContext); - writegetSignerAddressArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: getSignerAddress"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writegetSignerAddressArgs(encoder, input); - return buffer; -} - -export function writegetSignerAddressArgs( - writer: Write, - input: Input_getSignerAddress -): void { - writer.writeMapLength(1); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializegetSignerAddressResult(buffer: ArrayBuffer): string { - const context: Context = new Context("Deserializing imported module-type: getSignerAddress"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("getSignerAddress", "string", "reading function output"); - const res: string = reader.readString(); - reader.context().pop(); - - return res; -} - -export class Input_getSignerBalance { - blockTag: BigInt | null; - connection: Types.Ethereum_Connection | null; -} - -export function serializegetSignerBalanceArgs(input: Input_getSignerBalance): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: getSignerBalance"); - const sizer = new WriteSizer(sizerContext); - writegetSignerBalanceArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: getSignerBalance"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writegetSignerBalanceArgs(encoder, input); - return buffer; -} - -export function writegetSignerBalanceArgs( - writer: Write, - input: Input_getSignerBalance -): void { - writer.writeMapLength(2); - writer.context().push("blockTag", "BigInt | null", "writing property"); - writer.writeString("blockTag"); - writer.writeNullableBigInt(input.blockTag); - writer.context().pop(); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializegetSignerBalanceResult(buffer: ArrayBuffer): BigInt { - const context: Context = new Context("Deserializing imported module-type: getSignerBalance"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("getSignerBalance", "BigInt", "reading function output"); - const res: BigInt = reader.readBigInt(); - reader.context().pop(); - - return res; -} - -export class Input_getSignerTransactionCount { - blockTag: BigInt | null; - connection: Types.Ethereum_Connection | null; -} - -export function serializegetSignerTransactionCountArgs(input: Input_getSignerTransactionCount): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: getSignerTransactionCount"); - const sizer = new WriteSizer(sizerContext); - writegetSignerTransactionCountArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: getSignerTransactionCount"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writegetSignerTransactionCountArgs(encoder, input); - return buffer; -} - -export function writegetSignerTransactionCountArgs( - writer: Write, - input: Input_getSignerTransactionCount -): void { - writer.writeMapLength(2); - writer.context().push("blockTag", "BigInt | null", "writing property"); - writer.writeString("blockTag"); - writer.writeNullableBigInt(input.blockTag); - writer.context().pop(); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializegetSignerTransactionCountResult(buffer: ArrayBuffer): BigInt { - const context: Context = new Context("Deserializing imported module-type: getSignerTransactionCount"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("getSignerTransactionCount", "BigInt", "reading function output"); - const res: BigInt = reader.readBigInt(); - reader.context().pop(); - - return res; -} - -export class Input_getGasPrice { - connection: Types.Ethereum_Connection | null; -} - -export function serializegetGasPriceArgs(input: Input_getGasPrice): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: getGasPrice"); - const sizer = new WriteSizer(sizerContext); - writegetGasPriceArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: getGasPrice"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writegetGasPriceArgs(encoder, input); - return buffer; -} - -export function writegetGasPriceArgs( - writer: Write, - input: Input_getGasPrice -): void { - writer.writeMapLength(1); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializegetGasPriceResult(buffer: ArrayBuffer): BigInt { - const context: Context = new Context("Deserializing imported module-type: getGasPrice"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("getGasPrice", "BigInt", "reading function output"); - const res: BigInt = reader.readBigInt(); - reader.context().pop(); - - return res; -} - -export class Input_estimateTransactionGas { - tx: Types.Ethereum_TxRequest; - connection: Types.Ethereum_Connection | null; -} - -export function serializeestimateTransactionGasArgs(input: Input_estimateTransactionGas): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: estimateTransactionGas"); - const sizer = new WriteSizer(sizerContext); - writeestimateTransactionGasArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: estimateTransactionGas"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeestimateTransactionGasArgs(encoder, input); - return buffer; -} - -export function writeestimateTransactionGasArgs( - writer: Write, - input: Input_estimateTransactionGas -): void { - writer.writeMapLength(2); - writer.context().push("tx", "Types.Ethereum_TxRequest", "writing property"); - writer.writeString("tx"); - Types.Ethereum_TxRequest.write(writer, input.tx); - writer.context().pop(); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializeestimateTransactionGasResult(buffer: ArrayBuffer): BigInt { - const context: Context = new Context("Deserializing imported module-type: estimateTransactionGas"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("estimateTransactionGas", "BigInt", "reading function output"); - const res: BigInt = reader.readBigInt(); - reader.context().pop(); - - return res; -} - -export class Input_estimateContractCallGas { - address: string; - method: string; - args: Array | null; - connection: Types.Ethereum_Connection | null; - txOverrides: Types.Ethereum_TxOverrides | null; -} - -export function serializeestimateContractCallGasArgs(input: Input_estimateContractCallGas): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: estimateContractCallGas"); - const sizer = new WriteSizer(sizerContext); - writeestimateContractCallGasArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: estimateContractCallGas"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeestimateContractCallGasArgs(encoder, input); - return buffer; -} - -export function writeestimateContractCallGasArgs( - writer: Write, - input: Input_estimateContractCallGas -): void { - writer.writeMapLength(5); - writer.context().push("address", "string", "writing property"); - writer.writeString("address"); - writer.writeString(input.address); - writer.context().pop(); - writer.context().push("method", "string", "writing property"); - writer.writeString("method"); - writer.writeString(input.method); - writer.context().pop(); - writer.context().push("args", "Array | null", "writing property"); - writer.writeString("args"); - writer.writeNullableArray(input.args, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); - writer.context().push("txOverrides", "Types.Ethereum_TxOverrides | null", "writing property"); - writer.writeString("txOverrides"); - if (input.txOverrides) { - Types.Ethereum_TxOverrides.write(writer, input.txOverrides as Types.Ethereum_TxOverrides); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializeestimateContractCallGasResult(buffer: ArrayBuffer): BigInt { - const context: Context = new Context("Deserializing imported module-type: estimateContractCallGas"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("estimateContractCallGas", "BigInt", "reading function output"); - const res: BigInt = reader.readBigInt(); - reader.context().pop(); - - return res; -} - -export class Input_checkAddress { - address: string; -} - -export function serializecheckAddressArgs(input: Input_checkAddress): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: checkAddress"); - const sizer = new WriteSizer(sizerContext); - writecheckAddressArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: checkAddress"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writecheckAddressArgs(encoder, input); - return buffer; -} - -export function writecheckAddressArgs( - writer: Write, - input: Input_checkAddress -): void { - writer.writeMapLength(1); - writer.context().push("address", "string", "writing property"); - writer.writeString("address"); - writer.writeString(input.address); - writer.context().pop(); -} - -export function deserializecheckAddressResult(buffer: ArrayBuffer): bool { - const context: Context = new Context("Deserializing imported module-type: checkAddress"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("checkAddress", "bool", "reading function output"); - const res: bool = reader.readBool(); - reader.context().pop(); - - return res; -} - -export class Input_toWei { - eth: string; -} - -export function serializetoWeiArgs(input: Input_toWei): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: toWei"); - const sizer = new WriteSizer(sizerContext); - writetoWeiArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: toWei"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writetoWeiArgs(encoder, input); - return buffer; -} - -export function writetoWeiArgs( - writer: Write, - input: Input_toWei -): void { - writer.writeMapLength(1); - writer.context().push("eth", "string", "writing property"); - writer.writeString("eth"); - writer.writeString(input.eth); - writer.context().pop(); -} - -export function deserializetoWeiResult(buffer: ArrayBuffer): BigInt { - const context: Context = new Context("Deserializing imported module-type: toWei"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("toWei", "BigInt", "reading function output"); - const res: BigInt = reader.readBigInt(); - reader.context().pop(); - - return res; -} - -export class Input_toEth { - wei: BigInt; -} - -export function serializetoEthArgs(input: Input_toEth): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: toEth"); - const sizer = new WriteSizer(sizerContext); - writetoEthArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: toEth"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writetoEthArgs(encoder, input); - return buffer; -} - -export function writetoEthArgs( - writer: Write, - input: Input_toEth -): void { - writer.writeMapLength(1); - writer.context().push("wei", "BigInt", "writing property"); - writer.writeString("wei"); - writer.writeBigInt(input.wei); - writer.context().pop(); -} - -export function deserializetoEthResult(buffer: ArrayBuffer): string { - const context: Context = new Context("Deserializing imported module-type: toEth"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("toEth", "string", "reading function output"); - const res: string = reader.readString(); - reader.context().pop(); - - return res; -} - -export class Input_awaitTransaction { - txHash: string; - confirmations: u32; - timeout: u32; - connection: Types.Ethereum_Connection | null; -} - -export function serializeawaitTransactionArgs(input: Input_awaitTransaction): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: awaitTransaction"); - const sizer = new WriteSizer(sizerContext); - writeawaitTransactionArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: awaitTransaction"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeawaitTransactionArgs(encoder, input); - return buffer; -} - -export function writeawaitTransactionArgs( - writer: Write, - input: Input_awaitTransaction -): void { - writer.writeMapLength(4); - writer.context().push("txHash", "string", "writing property"); - writer.writeString("txHash"); - writer.writeString(input.txHash); - writer.context().pop(); - writer.context().push("confirmations", "u32", "writing property"); - writer.writeString("confirmations"); - writer.writeUInt32(input.confirmations); - writer.context().pop(); - writer.context().push("timeout", "u32", "writing property"); - writer.writeString("timeout"); - writer.writeUInt32(input.timeout); - writer.context().pop(); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializeawaitTransactionResult(buffer: ArrayBuffer): Types.Ethereum_TxReceipt { - const context: Context = new Context("Deserializing imported module-type: awaitTransaction"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("awaitTransaction", "Types.Ethereum_TxReceipt", "reading function output"); - const object = Types.Ethereum_TxReceipt.read(reader); - const res: Types.Ethereum_TxReceipt = object; - reader.context().pop(); - - return res; -} - -export class Input_waitForEvent { - address: string; - event: string; - args: Array | null; - timeout: Nullable; - connection: Types.Ethereum_Connection | null; -} - -export function serializewaitForEventArgs(input: Input_waitForEvent): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: waitForEvent"); - const sizer = new WriteSizer(sizerContext); - writewaitForEventArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: waitForEvent"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writewaitForEventArgs(encoder, input); - return buffer; -} - -export function writewaitForEventArgs( - writer: Write, - input: Input_waitForEvent -): void { - writer.writeMapLength(5); - writer.context().push("address", "string", "writing property"); - writer.writeString("address"); - writer.writeString(input.address); - writer.context().pop(); - writer.context().push("event", "string", "writing property"); - writer.writeString("event"); - writer.writeString(input.event); - writer.context().pop(); - writer.context().push("args", "Array | null", "writing property"); - writer.writeString("args"); - writer.writeNullableArray(input.args, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); - writer.context().push("timeout", "Nullable", "writing property"); - writer.writeString("timeout"); - writer.writeNullableUInt32(input.timeout); - writer.context().pop(); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializewaitForEventResult(buffer: ArrayBuffer): Types.Ethereum_EventNotification { - const context: Context = new Context("Deserializing imported module-type: waitForEvent"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("waitForEvent", "Types.Ethereum_EventNotification", "reading function output"); - const object = Types.Ethereum_EventNotification.read(reader); - const res: Types.Ethereum_EventNotification = object; - reader.context().pop(); - - return res; -} - -export class Input_getNetwork { - connection: Types.Ethereum_Connection | null; -} - -export function serializegetNetworkArgs(input: Input_getNetwork): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: getNetwork"); - const sizer = new WriteSizer(sizerContext); - writegetNetworkArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: getNetwork"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writegetNetworkArgs(encoder, input); - return buffer; -} - -export function writegetNetworkArgs( - writer: Write, - input: Input_getNetwork -): void { - writer.writeMapLength(1); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializegetNetworkResult(buffer: ArrayBuffer): Types.Ethereum_Network { - const context: Context = new Context("Deserializing imported module-type: getNetwork"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("getNetwork", "Types.Ethereum_Network", "reading function output"); - const object = Types.Ethereum_Network.read(reader); - const res: Types.Ethereum_Network = object; - reader.context().pop(); - - return res; -} - -export class Input_callContractMethod { - address: string; - method: string; - args: Array | null; - connection: Types.Ethereum_Connection | null; - txOverrides: Types.Ethereum_TxOverrides | null; -} - -export function serializecallContractMethodArgs(input: Input_callContractMethod): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: callContractMethod"); - const sizer = new WriteSizer(sizerContext); - writecallContractMethodArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: callContractMethod"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writecallContractMethodArgs(encoder, input); - return buffer; -} - -export function writecallContractMethodArgs( - writer: Write, - input: Input_callContractMethod -): void { - writer.writeMapLength(5); - writer.context().push("address", "string", "writing property"); - writer.writeString("address"); - writer.writeString(input.address); - writer.context().pop(); - writer.context().push("method", "string", "writing property"); - writer.writeString("method"); - writer.writeString(input.method); - writer.context().pop(); - writer.context().push("args", "Array | null", "writing property"); - writer.writeString("args"); - writer.writeNullableArray(input.args, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); - writer.context().push("txOverrides", "Types.Ethereum_TxOverrides | null", "writing property"); - writer.writeString("txOverrides"); - if (input.txOverrides) { - Types.Ethereum_TxOverrides.write(writer, input.txOverrides as Types.Ethereum_TxOverrides); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializecallContractMethodResult(buffer: ArrayBuffer): Types.Ethereum_TxResponse { - const context: Context = new Context("Deserializing imported module-type: callContractMethod"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("callContractMethod", "Types.Ethereum_TxResponse", "reading function output"); - const object = Types.Ethereum_TxResponse.read(reader); - const res: Types.Ethereum_TxResponse = object; - reader.context().pop(); - - return res; -} - -export class Input_callContractMethodAndWait { - address: string; - method: string; - args: Array | null; - connection: Types.Ethereum_Connection | null; - txOverrides: Types.Ethereum_TxOverrides | null; -} - -export function serializecallContractMethodAndWaitArgs(input: Input_callContractMethodAndWait): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: callContractMethodAndWait"); - const sizer = new WriteSizer(sizerContext); - writecallContractMethodAndWaitArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: callContractMethodAndWait"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writecallContractMethodAndWaitArgs(encoder, input); - return buffer; -} - -export function writecallContractMethodAndWaitArgs( - writer: Write, - input: Input_callContractMethodAndWait -): void { - writer.writeMapLength(5); - writer.context().push("address", "string", "writing property"); - writer.writeString("address"); - writer.writeString(input.address); - writer.context().pop(); - writer.context().push("method", "string", "writing property"); - writer.writeString("method"); - writer.writeString(input.method); - writer.context().pop(); - writer.context().push("args", "Array | null", "writing property"); - writer.writeString("args"); - writer.writeNullableArray(input.args, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); - writer.context().push("txOverrides", "Types.Ethereum_TxOverrides | null", "writing property"); - writer.writeString("txOverrides"); - if (input.txOverrides) { - Types.Ethereum_TxOverrides.write(writer, input.txOverrides as Types.Ethereum_TxOverrides); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializecallContractMethodAndWaitResult(buffer: ArrayBuffer): Types.Ethereum_TxReceipt { - const context: Context = new Context("Deserializing imported module-type: callContractMethodAndWait"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("callContractMethodAndWait", "Types.Ethereum_TxReceipt", "reading function output"); - const object = Types.Ethereum_TxReceipt.read(reader); - const res: Types.Ethereum_TxReceipt = object; - reader.context().pop(); - - return res; -} - -export class Input_sendTransaction { - tx: Types.Ethereum_TxRequest; - connection: Types.Ethereum_Connection | null; -} - -export function serializesendTransactionArgs(input: Input_sendTransaction): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: sendTransaction"); - const sizer = new WriteSizer(sizerContext); - writesendTransactionArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: sendTransaction"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writesendTransactionArgs(encoder, input); - return buffer; -} - -export function writesendTransactionArgs( - writer: Write, - input: Input_sendTransaction -): void { - writer.writeMapLength(2); - writer.context().push("tx", "Types.Ethereum_TxRequest", "writing property"); - writer.writeString("tx"); - Types.Ethereum_TxRequest.write(writer, input.tx); - writer.context().pop(); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializesendTransactionResult(buffer: ArrayBuffer): Types.Ethereum_TxResponse { - const context: Context = new Context("Deserializing imported module-type: sendTransaction"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("sendTransaction", "Types.Ethereum_TxResponse", "reading function output"); - const object = Types.Ethereum_TxResponse.read(reader); - const res: Types.Ethereum_TxResponse = object; - reader.context().pop(); - - return res; -} - -export class Input_sendTransactionAndWait { - tx: Types.Ethereum_TxRequest; - connection: Types.Ethereum_Connection | null; -} - -export function serializesendTransactionAndWaitArgs(input: Input_sendTransactionAndWait): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: sendTransactionAndWait"); - const sizer = new WriteSizer(sizerContext); - writesendTransactionAndWaitArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: sendTransactionAndWait"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writesendTransactionAndWaitArgs(encoder, input); - return buffer; -} - -export function writesendTransactionAndWaitArgs( - writer: Write, - input: Input_sendTransactionAndWait -): void { - writer.writeMapLength(2); - writer.context().push("tx", "Types.Ethereum_TxRequest", "writing property"); - writer.writeString("tx"); - Types.Ethereum_TxRequest.write(writer, input.tx); - writer.context().pop(); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializesendTransactionAndWaitResult(buffer: ArrayBuffer): Types.Ethereum_TxReceipt { - const context: Context = new Context("Deserializing imported module-type: sendTransactionAndWait"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("sendTransactionAndWait", "Types.Ethereum_TxReceipt", "reading function output"); - const object = Types.Ethereum_TxReceipt.read(reader); - const res: Types.Ethereum_TxReceipt = object; - reader.context().pop(); - - return res; -} - -export class Input_deployContract { - abi: string; - bytecode: string; - args: Array | null; - connection: Types.Ethereum_Connection | null; -} - -export function serializedeployContractArgs(input: Input_deployContract): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: deployContract"); - const sizer = new WriteSizer(sizerContext); - writedeployContractArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: deployContract"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writedeployContractArgs(encoder, input); - return buffer; -} - -export function writedeployContractArgs( - writer: Write, - input: Input_deployContract -): void { - writer.writeMapLength(4); - writer.context().push("abi", "string", "writing property"); - writer.writeString("abi"); - writer.writeString(input.abi); - writer.context().pop(); - writer.context().push("bytecode", "string", "writing property"); - writer.writeString("bytecode"); - writer.writeString(input.bytecode); - writer.context().pop(); - writer.context().push("args", "Array | null", "writing property"); - writer.writeString("args"); - writer.writeNullableArray(input.args, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializedeployContractResult(buffer: ArrayBuffer): string { - const context: Context = new Context("Deserializing imported module-type: deployContract"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("deployContract", "string", "reading function output"); - const res: string = reader.readString(); - reader.context().pop(); - - return res; -} - -export class Input_signMessage { - message: string; - connection: Types.Ethereum_Connection | null; -} - -export function serializesignMessageArgs(input: Input_signMessage): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: signMessage"); - const sizer = new WriteSizer(sizerContext); - writesignMessageArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: signMessage"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writesignMessageArgs(encoder, input); - return buffer; -} - -export function writesignMessageArgs( - writer: Write, - input: Input_signMessage -): void { - writer.writeMapLength(2); - writer.context().push("message", "string", "writing property"); - writer.writeString("message"); - writer.writeString(input.message); - writer.context().pop(); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializesignMessageResult(buffer: ArrayBuffer): string { - const context: Context = new Context("Deserializing imported module-type: signMessage"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("signMessage", "string", "reading function output"); - const res: string = reader.readString(); - reader.context().pop(); - - return res; -} - -export class Input_sendRPC { - method: string; - params: Array; - connection: Types.Ethereum_Connection | null; -} - -export function serializesendRPCArgs(input: Input_sendRPC): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported module-type: sendRPC"); - const sizer = new WriteSizer(sizerContext); - writesendRPCArgs(sizer, input); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) imported module-type: sendRPC"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writesendRPCArgs(encoder, input); - return buffer; -} - -export function writesendRPCArgs( - writer: Write, - input: Input_sendRPC -): void { - writer.writeMapLength(3); - writer.context().push("method", "string", "writing property"); - writer.writeString("method"); - writer.writeString(input.method); - writer.context().pop(); - writer.context().push("params", "Array", "writing property"); - writer.writeString("params"); - writer.writeArray(input.params, (writer: Write, item: string): void => { - writer.writeString(item); - }); - writer.context().pop(); - writer.context().push("connection", "Types.Ethereum_Connection | null", "writing property"); - writer.writeString("connection"); - if (input.connection) { - Types.Ethereum_Connection.write(writer, input.connection as Types.Ethereum_Connection); - } else { - writer.writeNil(); - } - writer.context().pop(); -} - -export function deserializesendRPCResult(buffer: ArrayBuffer): string | null { - const context: Context = new Context("Deserializing imported module-type: sendRPC"); - const reader = new ReadDecoder(buffer, context); - - reader.context().push("sendRPC", "string | null", "reading function output"); - const res: string | null = reader.readNullableString(); - reader.context().pop(); - - return res; -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Network/index.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Network/index.ts deleted file mode 100644 index 00cd4c08e7..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Network/index.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - Read, - Write, - Nullable, - BigInt, - BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, -} from "@web3api/wasm-as"; -import { - serializeEthereum_Network, - deserializeEthereum_Network, - writeEthereum_Network, - readEthereum_Network -} from "./serialization"; -import * as Types from "../.."; - -@serializable -export class Ethereum_Network { - - public static uri: string = "w3://ens/ethereum.web3api.eth"; - - name: string; - chainId: BigInt; - ensAddress: string | null; - - static toBuffer(type: Ethereum_Network): ArrayBuffer { - return serializeEthereum_Network(type); - } - - static fromBuffer(buffer: ArrayBuffer): Ethereum_Network { - return deserializeEthereum_Network(buffer); - } - - static write(writer: Write, type: Ethereum_Network): void { - writeEthereum_Network(writer, type); - } - - static read(reader: Read): Ethereum_Network { - return readEthereum_Network(reader); - } - - static toJson(type: Ethereum_Network): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): Ethereum_Network { - return (new JSONDeserializer(json)).decode(); - } -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Network/serialization.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Network/serialization.ts deleted file mode 100644 index 524a5bbe1e..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_Network/serialization.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { - Read, - ReadDecoder, - Write, - WriteSizer, - WriteEncoder, - Nullable, - BigInt, - BigNumber, - JSON, - Context -} from "@web3api/wasm-as"; -import { Ethereum_Network } from "./"; -import * as Types from "../.."; - -export function serializeEthereum_Network(type: Ethereum_Network): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported object-type: Ethereum_Network"); - const sizer = new WriteSizer(sizerContext); - writeEthereum_Network(sizer, type); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) import object-type: Ethereum_Network"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeEthereum_Network(encoder, type); - return buffer; -} - -export function writeEthereum_Network(writer: Write, type: Ethereum_Network): void { - writer.writeMapLength(3); - writer.context().push("name", "string", "writing property"); - writer.writeString("name"); - writer.writeString(type.name); - writer.context().pop(); - writer.context().push("chainId", "BigInt", "writing property"); - writer.writeString("chainId"); - writer.writeBigInt(type.chainId); - writer.context().pop(); - writer.context().push("ensAddress", "string | null", "writing property"); - writer.writeString("ensAddress"); - writer.writeNullableString(type.ensAddress); - writer.context().pop(); -} - -export function deserializeEthereum_Network(buffer: ArrayBuffer): Ethereum_Network { - const context: Context = new Context("Deserializing imported object-type Ethereum_Network"); - const reader = new ReadDecoder(buffer, context); - return readEthereum_Network(reader); -} - -export function readEthereum_Network(reader: Read): Ethereum_Network { - let numFields = reader.readMapLength(); - - let _name: string = ""; - let _nameSet: bool = false; - let _chainId: BigInt = BigInt.fromUInt16(0); - let _chainIdSet: bool = false; - let _ensAddress: string | null = null; - - while (numFields > 0) { - numFields--; - const field = reader.readString(); - - reader.context().push(field, "unknown", "searching for property type"); - if (field == "name") { - reader.context().push(field, "string", "type found, reading property"); - _name = reader.readString(); - _nameSet = true; - reader.context().pop(); - } - else if (field == "chainId") { - reader.context().push(field, "BigInt", "type found, reading property"); - _chainId = reader.readBigInt(); - _chainIdSet = true; - reader.context().pop(); - } - else if (field == "ensAddress") { - reader.context().push(field, "string | null", "type found, reading property"); - _ensAddress = reader.readNullableString(); - reader.context().pop(); - } - reader.context().pop(); - } - - if (!_nameSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'name: String'")); - } - if (!_chainIdSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'chainId: BigInt'")); - } - - return { - name: _name, - chainId: _chainId, - ensAddress: _ensAddress - }; -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_StaticTxResult/index.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_StaticTxResult/index.ts deleted file mode 100644 index 0f55ea6026..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_StaticTxResult/index.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { - Read, - Write, - Nullable, - BigInt, - BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, -} from "@web3api/wasm-as"; -import { - serializeEthereum_StaticTxResult, - deserializeEthereum_StaticTxResult, - writeEthereum_StaticTxResult, - readEthereum_StaticTxResult -} from "./serialization"; -import * as Types from "../.."; - -@serializable -export class Ethereum_StaticTxResult { - - public static uri: string = "w3://ens/ethereum.web3api.eth"; - - result: string; - error: bool; - - static toBuffer(type: Ethereum_StaticTxResult): ArrayBuffer { - return serializeEthereum_StaticTxResult(type); - } - - static fromBuffer(buffer: ArrayBuffer): Ethereum_StaticTxResult { - return deserializeEthereum_StaticTxResult(buffer); - } - - static write(writer: Write, type: Ethereum_StaticTxResult): void { - writeEthereum_StaticTxResult(writer, type); - } - - static read(reader: Read): Ethereum_StaticTxResult { - return readEthereum_StaticTxResult(reader); - } - - static toJson(type: Ethereum_StaticTxResult): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): Ethereum_StaticTxResult { - return (new JSONDeserializer(json)).decode(); - } -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_StaticTxResult/serialization.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_StaticTxResult/serialization.ts deleted file mode 100644 index d0c455f6a8..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_StaticTxResult/serialization.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { - Read, - ReadDecoder, - Write, - WriteSizer, - WriteEncoder, - Nullable, - BigInt, - BigNumber, - JSON, - Context -} from "@web3api/wasm-as"; -import { Ethereum_StaticTxResult } from "./"; -import * as Types from "../.."; - -export function serializeEthereum_StaticTxResult(type: Ethereum_StaticTxResult): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported object-type: Ethereum_StaticTxResult"); - const sizer = new WriteSizer(sizerContext); - writeEthereum_StaticTxResult(sizer, type); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) import object-type: Ethereum_StaticTxResult"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeEthereum_StaticTxResult(encoder, type); - return buffer; -} - -export function writeEthereum_StaticTxResult(writer: Write, type: Ethereum_StaticTxResult): void { - writer.writeMapLength(2); - writer.context().push("result", "string", "writing property"); - writer.writeString("result"); - writer.writeString(type.result); - writer.context().pop(); - writer.context().push("error", "bool", "writing property"); - writer.writeString("error"); - writer.writeBool(type.error); - writer.context().pop(); -} - -export function deserializeEthereum_StaticTxResult(buffer: ArrayBuffer): Ethereum_StaticTxResult { - const context: Context = new Context("Deserializing imported object-type Ethereum_StaticTxResult"); - const reader = new ReadDecoder(buffer, context); - return readEthereum_StaticTxResult(reader); -} - -export function readEthereum_StaticTxResult(reader: Read): Ethereum_StaticTxResult { - let numFields = reader.readMapLength(); - - let _result: string = ""; - let _resultSet: bool = false; - let _error: bool = false; - let _errorSet: bool = false; - - while (numFields > 0) { - numFields--; - const field = reader.readString(); - - reader.context().push(field, "unknown", "searching for property type"); - if (field == "result") { - reader.context().push(field, "string", "type found, reading property"); - _result = reader.readString(); - _resultSet = true; - reader.context().pop(); - } - else if (field == "error") { - reader.context().push(field, "bool", "type found, reading property"); - _error = reader.readBool(); - _errorSet = true; - reader.context().pop(); - } - reader.context().pop(); - } - - if (!_resultSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'result: String'")); - } - if (!_errorSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'error: Boolean'")); - } - - return { - result: _result, - error: _error - }; -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxOverrides/index.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxOverrides/index.ts deleted file mode 100644 index 62e9bfb825..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxOverrides/index.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - Read, - Write, - Nullable, - BigInt, - BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, -} from "@web3api/wasm-as"; -import { - serializeEthereum_TxOverrides, - deserializeEthereum_TxOverrides, - writeEthereum_TxOverrides, - readEthereum_TxOverrides -} from "./serialization"; -import * as Types from "../.."; - -@serializable -export class Ethereum_TxOverrides { - - public static uri: string = "w3://ens/ethereum.web3api.eth"; - - gasLimit: BigInt | null; - gasPrice: BigInt | null; - value: BigInt | null; - - static toBuffer(type: Ethereum_TxOverrides): ArrayBuffer { - return serializeEthereum_TxOverrides(type); - } - - static fromBuffer(buffer: ArrayBuffer): Ethereum_TxOverrides { - return deserializeEthereum_TxOverrides(buffer); - } - - static write(writer: Write, type: Ethereum_TxOverrides): void { - writeEthereum_TxOverrides(writer, type); - } - - static read(reader: Read): Ethereum_TxOverrides { - return readEthereum_TxOverrides(reader); - } - - static toJson(type: Ethereum_TxOverrides): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): Ethereum_TxOverrides { - return (new JSONDeserializer(json)).decode(); - } -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxOverrides/serialization.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxOverrides/serialization.ts deleted file mode 100644 index 029c758973..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxOverrides/serialization.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { - Read, - ReadDecoder, - Write, - WriteSizer, - WriteEncoder, - Nullable, - BigInt, - BigNumber, - JSON, - Context -} from "@web3api/wasm-as"; -import { Ethereum_TxOverrides } from "./"; -import * as Types from "../.."; - -export function serializeEthereum_TxOverrides(type: Ethereum_TxOverrides): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported object-type: Ethereum_TxOverrides"); - const sizer = new WriteSizer(sizerContext); - writeEthereum_TxOverrides(sizer, type); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) import object-type: Ethereum_TxOverrides"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeEthereum_TxOverrides(encoder, type); - return buffer; -} - -export function writeEthereum_TxOverrides(writer: Write, type: Ethereum_TxOverrides): void { - writer.writeMapLength(3); - writer.context().push("gasLimit", "BigInt | null", "writing property"); - writer.writeString("gasLimit"); - writer.writeNullableBigInt(type.gasLimit); - writer.context().pop(); - writer.context().push("gasPrice", "BigInt | null", "writing property"); - writer.writeString("gasPrice"); - writer.writeNullableBigInt(type.gasPrice); - writer.context().pop(); - writer.context().push("value", "BigInt | null", "writing property"); - writer.writeString("value"); - writer.writeNullableBigInt(type.value); - writer.context().pop(); -} - -export function deserializeEthereum_TxOverrides(buffer: ArrayBuffer): Ethereum_TxOverrides { - const context: Context = new Context("Deserializing imported object-type Ethereum_TxOverrides"); - const reader = new ReadDecoder(buffer, context); - return readEthereum_TxOverrides(reader); -} - -export function readEthereum_TxOverrides(reader: Read): Ethereum_TxOverrides { - let numFields = reader.readMapLength(); - - let _gasLimit: BigInt | null = null; - let _gasPrice: BigInt | null = null; - let _value: BigInt | null = null; - - while (numFields > 0) { - numFields--; - const field = reader.readString(); - - reader.context().push(field, "unknown", "searching for property type"); - if (field == "gasLimit") { - reader.context().push(field, "BigInt | null", "type found, reading property"); - _gasLimit = reader.readNullableBigInt(); - reader.context().pop(); - } - else if (field == "gasPrice") { - reader.context().push(field, "BigInt | null", "type found, reading property"); - _gasPrice = reader.readNullableBigInt(); - reader.context().pop(); - } - else if (field == "value") { - reader.context().push(field, "BigInt | null", "type found, reading property"); - _value = reader.readNullableBigInt(); - reader.context().pop(); - } - reader.context().pop(); - } - - - return { - gasLimit: _gasLimit, - gasPrice: _gasPrice, - value: _value - }; -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxReceipt/index.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxReceipt/index.ts deleted file mode 100644 index c0edd57c43..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxReceipt/index.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { - Read, - Write, - Nullable, - BigInt, - BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, -} from "@web3api/wasm-as"; -import { - serializeEthereum_TxReceipt, - deserializeEthereum_TxReceipt, - writeEthereum_TxReceipt, - readEthereum_TxReceipt -} from "./serialization"; -import * as Types from "../.."; - -@serializable -export class Ethereum_TxReceipt { - - public static uri: string = "w3://ens/ethereum.web3api.eth"; - - to: string; - m_from: string; - contractAddress: string; - transactionIndex: u32; - root: string | null; - gasUsed: BigInt; - logsBloom: string; - transactionHash: string; - logs: Array; - blockNumber: BigInt; - blockHash: string; - confirmations: u32; - cumulativeGasUsed: BigInt; - effectiveGasPrice: BigInt; - byzantium: bool; - m_type: u32; - status: Nullable; - - static toBuffer(type: Ethereum_TxReceipt): ArrayBuffer { - return serializeEthereum_TxReceipt(type); - } - - static fromBuffer(buffer: ArrayBuffer): Ethereum_TxReceipt { - return deserializeEthereum_TxReceipt(buffer); - } - - static write(writer: Write, type: Ethereum_TxReceipt): void { - writeEthereum_TxReceipt(writer, type); - } - - static read(reader: Read): Ethereum_TxReceipt { - return readEthereum_TxReceipt(reader); - } - - static toJson(type: Ethereum_TxReceipt): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): Ethereum_TxReceipt { - return (new JSONDeserializer(json)).decode(); - } -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxReceipt/serialization.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxReceipt/serialization.ts deleted file mode 100644 index 48e81553a5..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxReceipt/serialization.ts +++ /dev/null @@ -1,319 +0,0 @@ -import { - Read, - ReadDecoder, - Write, - WriteSizer, - WriteEncoder, - Nullable, - BigInt, - BigNumber, - JSON, - Context -} from "@web3api/wasm-as"; -import { Ethereum_TxReceipt } from "./"; -import * as Types from "../.."; - -export function serializeEthereum_TxReceipt(type: Ethereum_TxReceipt): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported object-type: Ethereum_TxReceipt"); - const sizer = new WriteSizer(sizerContext); - writeEthereum_TxReceipt(sizer, type); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) import object-type: Ethereum_TxReceipt"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeEthereum_TxReceipt(encoder, type); - return buffer; -} - -export function writeEthereum_TxReceipt(writer: Write, type: Ethereum_TxReceipt): void { - writer.writeMapLength(17); - writer.context().push("to", "string", "writing property"); - writer.writeString("to"); - writer.writeString(type.to); - writer.context().pop(); - writer.context().push("from", "string", "writing property"); - writer.writeString("from"); - writer.writeString(type.m_from); - writer.context().pop(); - writer.context().push("contractAddress", "string", "writing property"); - writer.writeString("contractAddress"); - writer.writeString(type.contractAddress); - writer.context().pop(); - writer.context().push("transactionIndex", "u32", "writing property"); - writer.writeString("transactionIndex"); - writer.writeUInt32(type.transactionIndex); - writer.context().pop(); - writer.context().push("root", "string | null", "writing property"); - writer.writeString("root"); - writer.writeNullableString(type.root); - writer.context().pop(); - writer.context().push("gasUsed", "BigInt", "writing property"); - writer.writeString("gasUsed"); - writer.writeBigInt(type.gasUsed); - writer.context().pop(); - writer.context().push("logsBloom", "string", "writing property"); - writer.writeString("logsBloom"); - writer.writeString(type.logsBloom); - writer.context().pop(); - writer.context().push("transactionHash", "string", "writing property"); - writer.writeString("transactionHash"); - writer.writeString(type.transactionHash); - writer.context().pop(); - writer.context().push("logs", "Array", "writing property"); - writer.writeString("logs"); - writer.writeArray(type.logs, (writer: Write, item: Types.Ethereum_Log): void => { - Types.Ethereum_Log.write(writer, item); - }); - writer.context().pop(); - writer.context().push("blockNumber", "BigInt", "writing property"); - writer.writeString("blockNumber"); - writer.writeBigInt(type.blockNumber); - writer.context().pop(); - writer.context().push("blockHash", "string", "writing property"); - writer.writeString("blockHash"); - writer.writeString(type.blockHash); - writer.context().pop(); - writer.context().push("confirmations", "u32", "writing property"); - writer.writeString("confirmations"); - writer.writeUInt32(type.confirmations); - writer.context().pop(); - writer.context().push("cumulativeGasUsed", "BigInt", "writing property"); - writer.writeString("cumulativeGasUsed"); - writer.writeBigInt(type.cumulativeGasUsed); - writer.context().pop(); - writer.context().push("effectiveGasPrice", "BigInt", "writing property"); - writer.writeString("effectiveGasPrice"); - writer.writeBigInt(type.effectiveGasPrice); - writer.context().pop(); - writer.context().push("byzantium", "bool", "writing property"); - writer.writeString("byzantium"); - writer.writeBool(type.byzantium); - writer.context().pop(); - writer.context().push("type", "u32", "writing property"); - writer.writeString("type"); - writer.writeUInt32(type.m_type); - writer.context().pop(); - writer.context().push("status", "Nullable", "writing property"); - writer.writeString("status"); - writer.writeNullableUInt32(type.status); - writer.context().pop(); -} - -export function deserializeEthereum_TxReceipt(buffer: ArrayBuffer): Ethereum_TxReceipt { - const context: Context = new Context("Deserializing imported object-type Ethereum_TxReceipt"); - const reader = new ReadDecoder(buffer, context); - return readEthereum_TxReceipt(reader); -} - -export function readEthereum_TxReceipt(reader: Read): Ethereum_TxReceipt { - let numFields = reader.readMapLength(); - - let _to: string = ""; - let _toSet: bool = false; - let _from: string = ""; - let _fromSet: bool = false; - let _contractAddress: string = ""; - let _contractAddressSet: bool = false; - let _transactionIndex: u32 = 0; - let _transactionIndexSet: bool = false; - let _root: string | null = null; - let _gasUsed: BigInt = BigInt.fromUInt16(0); - let _gasUsedSet: bool = false; - let _logsBloom: string = ""; - let _logsBloomSet: bool = false; - let _transactionHash: string = ""; - let _transactionHashSet: bool = false; - let _logs: Array = []; - let _logsSet: bool = false; - let _blockNumber: BigInt = BigInt.fromUInt16(0); - let _blockNumberSet: bool = false; - let _blockHash: string = ""; - let _blockHashSet: bool = false; - let _confirmations: u32 = 0; - let _confirmationsSet: bool = false; - let _cumulativeGasUsed: BigInt = BigInt.fromUInt16(0); - let _cumulativeGasUsedSet: bool = false; - let _effectiveGasPrice: BigInt = BigInt.fromUInt16(0); - let _effectiveGasPriceSet: bool = false; - let _byzantium: bool = false; - let _byzantiumSet: bool = false; - let _type: u32 = 0; - let _typeSet: bool = false; - let _status: Nullable = new Nullable(); - - while (numFields > 0) { - numFields--; - const field = reader.readString(); - - reader.context().push(field, "unknown", "searching for property type"); - if (field == "to") { - reader.context().push(field, "string", "type found, reading property"); - _to = reader.readString(); - _toSet = true; - reader.context().pop(); - } - else if (field == "from") { - reader.context().push(field, "string", "type found, reading property"); - _from = reader.readString(); - _fromSet = true; - reader.context().pop(); - } - else if (field == "contractAddress") { - reader.context().push(field, "string", "type found, reading property"); - _contractAddress = reader.readString(); - _contractAddressSet = true; - reader.context().pop(); - } - else if (field == "transactionIndex") { - reader.context().push(field, "u32", "type found, reading property"); - _transactionIndex = reader.readUInt32(); - _transactionIndexSet = true; - reader.context().pop(); - } - else if (field == "root") { - reader.context().push(field, "string | null", "type found, reading property"); - _root = reader.readNullableString(); - reader.context().pop(); - } - else if (field == "gasUsed") { - reader.context().push(field, "BigInt", "type found, reading property"); - _gasUsed = reader.readBigInt(); - _gasUsedSet = true; - reader.context().pop(); - } - else if (field == "logsBloom") { - reader.context().push(field, "string", "type found, reading property"); - _logsBloom = reader.readString(); - _logsBloomSet = true; - reader.context().pop(); - } - else if (field == "transactionHash") { - reader.context().push(field, "string", "type found, reading property"); - _transactionHash = reader.readString(); - _transactionHashSet = true; - reader.context().pop(); - } - else if (field == "logs") { - reader.context().push(field, "Array", "type found, reading property"); - _logs = reader.readArray((reader: Read): Types.Ethereum_Log => { - const object = Types.Ethereum_Log.read(reader); - return object; - }); - _logsSet = true; - reader.context().pop(); - } - else if (field == "blockNumber") { - reader.context().push(field, "BigInt", "type found, reading property"); - _blockNumber = reader.readBigInt(); - _blockNumberSet = true; - reader.context().pop(); - } - else if (field == "blockHash") { - reader.context().push(field, "string", "type found, reading property"); - _blockHash = reader.readString(); - _blockHashSet = true; - reader.context().pop(); - } - else if (field == "confirmations") { - reader.context().push(field, "u32", "type found, reading property"); - _confirmations = reader.readUInt32(); - _confirmationsSet = true; - reader.context().pop(); - } - else if (field == "cumulativeGasUsed") { - reader.context().push(field, "BigInt", "type found, reading property"); - _cumulativeGasUsed = reader.readBigInt(); - _cumulativeGasUsedSet = true; - reader.context().pop(); - } - else if (field == "effectiveGasPrice") { - reader.context().push(field, "BigInt", "type found, reading property"); - _effectiveGasPrice = reader.readBigInt(); - _effectiveGasPriceSet = true; - reader.context().pop(); - } - else if (field == "byzantium") { - reader.context().push(field, "bool", "type found, reading property"); - _byzantium = reader.readBool(); - _byzantiumSet = true; - reader.context().pop(); - } - else if (field == "type") { - reader.context().push(field, "u32", "type found, reading property"); - _type = reader.readUInt32(); - _typeSet = true; - reader.context().pop(); - } - else if (field == "status") { - reader.context().push(field, "Nullable", "type found, reading property"); - _status = reader.readNullableUInt32(); - reader.context().pop(); - } - reader.context().pop(); - } - - if (!_toSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'to: String'")); - } - if (!_fromSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'from: String'")); - } - if (!_contractAddressSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'contractAddress: String'")); - } - if (!_transactionIndexSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'transactionIndex: UInt32'")); - } - if (!_gasUsedSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'gasUsed: BigInt'")); - } - if (!_logsBloomSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'logsBloom: String'")); - } - if (!_transactionHashSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'transactionHash: String'")); - } - if (!_logsSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'logs: [Ethereum_Log]'")); - } - if (!_blockNumberSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'blockNumber: BigInt'")); - } - if (!_blockHashSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'blockHash: String'")); - } - if (!_confirmationsSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'confirmations: UInt32'")); - } - if (!_cumulativeGasUsedSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'cumulativeGasUsed: BigInt'")); - } - if (!_effectiveGasPriceSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'effectiveGasPrice: BigInt'")); - } - if (!_byzantiumSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'byzantium: Boolean'")); - } - if (!_typeSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'type: UInt32'")); - } - - return { - to: _to, - m_from: _from, - contractAddress: _contractAddress, - transactionIndex: _transactionIndex, - root: _root, - gasUsed: _gasUsed, - logsBloom: _logsBloom, - transactionHash: _transactionHash, - logs: _logs, - blockNumber: _blockNumber, - blockHash: _blockHash, - confirmations: _confirmations, - cumulativeGasUsed: _cumulativeGasUsed, - effectiveGasPrice: _effectiveGasPrice, - byzantium: _byzantium, - m_type: _type, - status: _status - }; -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxRequest/index.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxRequest/index.ts deleted file mode 100644 index e251c81a29..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxRequest/index.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { - Read, - Write, - Nullable, - BigInt, - BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, -} from "@web3api/wasm-as"; -import { - serializeEthereum_TxRequest, - deserializeEthereum_TxRequest, - writeEthereum_TxRequest, - readEthereum_TxRequest -} from "./serialization"; -import * as Types from "../.."; - -@serializable -export class Ethereum_TxRequest { - - public static uri: string = "w3://ens/ethereum.web3api.eth"; - - to: string | null; - m_from: string | null; - nonce: Nullable; - gasLimit: BigInt | null; - gasPrice: BigInt | null; - data: string | null; - value: BigInt | null; - chainId: BigInt | null; - m_type: Nullable; - - static toBuffer(type: Ethereum_TxRequest): ArrayBuffer { - return serializeEthereum_TxRequest(type); - } - - static fromBuffer(buffer: ArrayBuffer): Ethereum_TxRequest { - return deserializeEthereum_TxRequest(buffer); - } - - static write(writer: Write, type: Ethereum_TxRequest): void { - writeEthereum_TxRequest(writer, type); - } - - static read(reader: Read): Ethereum_TxRequest { - return readEthereum_TxRequest(reader); - } - - static toJson(type: Ethereum_TxRequest): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): Ethereum_TxRequest { - return (new JSONDeserializer(json)).decode(); - } -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxRequest/serialization.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxRequest/serialization.ts deleted file mode 100644 index 970feff430..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxRequest/serialization.ts +++ /dev/null @@ -1,151 +0,0 @@ -import { - Read, - ReadDecoder, - Write, - WriteSizer, - WriteEncoder, - Nullable, - BigInt, - BigNumber, - JSON, - Context -} from "@web3api/wasm-as"; -import { Ethereum_TxRequest } from "./"; -import * as Types from "../.."; - -export function serializeEthereum_TxRequest(type: Ethereum_TxRequest): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported object-type: Ethereum_TxRequest"); - const sizer = new WriteSizer(sizerContext); - writeEthereum_TxRequest(sizer, type); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) import object-type: Ethereum_TxRequest"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeEthereum_TxRequest(encoder, type); - return buffer; -} - -export function writeEthereum_TxRequest(writer: Write, type: Ethereum_TxRequest): void { - writer.writeMapLength(9); - writer.context().push("to", "string | null", "writing property"); - writer.writeString("to"); - writer.writeNullableString(type.to); - writer.context().pop(); - writer.context().push("from", "string | null", "writing property"); - writer.writeString("from"); - writer.writeNullableString(type.m_from); - writer.context().pop(); - writer.context().push("nonce", "Nullable", "writing property"); - writer.writeString("nonce"); - writer.writeNullableUInt32(type.nonce); - writer.context().pop(); - writer.context().push("gasLimit", "BigInt | null", "writing property"); - writer.writeString("gasLimit"); - writer.writeNullableBigInt(type.gasLimit); - writer.context().pop(); - writer.context().push("gasPrice", "BigInt | null", "writing property"); - writer.writeString("gasPrice"); - writer.writeNullableBigInt(type.gasPrice); - writer.context().pop(); - writer.context().push("data", "string | null", "writing property"); - writer.writeString("data"); - writer.writeNullableString(type.data); - writer.context().pop(); - writer.context().push("value", "BigInt | null", "writing property"); - writer.writeString("value"); - writer.writeNullableBigInt(type.value); - writer.context().pop(); - writer.context().push("chainId", "BigInt | null", "writing property"); - writer.writeString("chainId"); - writer.writeNullableBigInt(type.chainId); - writer.context().pop(); - writer.context().push("type", "Nullable", "writing property"); - writer.writeString("type"); - writer.writeNullableUInt32(type.m_type); - writer.context().pop(); -} - -export function deserializeEthereum_TxRequest(buffer: ArrayBuffer): Ethereum_TxRequest { - const context: Context = new Context("Deserializing imported object-type Ethereum_TxRequest"); - const reader = new ReadDecoder(buffer, context); - return readEthereum_TxRequest(reader); -} - -export function readEthereum_TxRequest(reader: Read): Ethereum_TxRequest { - let numFields = reader.readMapLength(); - - let _to: string | null = null; - let _from: string | null = null; - let _nonce: Nullable = new Nullable(); - let _gasLimit: BigInt | null = null; - let _gasPrice: BigInt | null = null; - let _data: string | null = null; - let _value: BigInt | null = null; - let _chainId: BigInt | null = null; - let _type: Nullable = new Nullable(); - - while (numFields > 0) { - numFields--; - const field = reader.readString(); - - reader.context().push(field, "unknown", "searching for property type"); - if (field == "to") { - reader.context().push(field, "string | null", "type found, reading property"); - _to = reader.readNullableString(); - reader.context().pop(); - } - else if (field == "from") { - reader.context().push(field, "string | null", "type found, reading property"); - _from = reader.readNullableString(); - reader.context().pop(); - } - else if (field == "nonce") { - reader.context().push(field, "Nullable", "type found, reading property"); - _nonce = reader.readNullableUInt32(); - reader.context().pop(); - } - else if (field == "gasLimit") { - reader.context().push(field, "BigInt | null", "type found, reading property"); - _gasLimit = reader.readNullableBigInt(); - reader.context().pop(); - } - else if (field == "gasPrice") { - reader.context().push(field, "BigInt | null", "type found, reading property"); - _gasPrice = reader.readNullableBigInt(); - reader.context().pop(); - } - else if (field == "data") { - reader.context().push(field, "string | null", "type found, reading property"); - _data = reader.readNullableString(); - reader.context().pop(); - } - else if (field == "value") { - reader.context().push(field, "BigInt | null", "type found, reading property"); - _value = reader.readNullableBigInt(); - reader.context().pop(); - } - else if (field == "chainId") { - reader.context().push(field, "BigInt | null", "type found, reading property"); - _chainId = reader.readNullableBigInt(); - reader.context().pop(); - } - else if (field == "type") { - reader.context().push(field, "Nullable", "type found, reading property"); - _type = reader.readNullableUInt32(); - reader.context().pop(); - } - reader.context().pop(); - } - - - return { - to: _to, - m_from: _from, - nonce: _nonce, - gasLimit: _gasLimit, - gasPrice: _gasPrice, - data: _data, - value: _value, - chainId: _chainId, - m_type: _type - }; -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxResponse/index.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxResponse/index.ts deleted file mode 100644 index b8e5231b29..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxResponse/index.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { - Read, - Write, - Nullable, - BigInt, - BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, -} from "@web3api/wasm-as"; -import { - serializeEthereum_TxResponse, - deserializeEthereum_TxResponse, - writeEthereum_TxResponse, - readEthereum_TxResponse -} from "./serialization"; -import * as Types from "../.."; - -@serializable -export class Ethereum_TxResponse { - - public static uri: string = "w3://ens/ethereum.web3api.eth"; - - hash: string; - to: string | null; - m_from: string; - nonce: u32; - gasLimit: BigInt; - gasPrice: BigInt | null; - data: string; - value: BigInt; - chainId: BigInt; - blockNumber: BigInt | null; - blockHash: string | null; - timestamp: Nullable; - confirmations: u32; - raw: string | null; - r: string | null; - s: string | null; - v: Nullable; - m_type: Nullable; - accessList: Array | null; - - static toBuffer(type: Ethereum_TxResponse): ArrayBuffer { - return serializeEthereum_TxResponse(type); - } - - static fromBuffer(buffer: ArrayBuffer): Ethereum_TxResponse { - return deserializeEthereum_TxResponse(buffer); - } - - static write(writer: Write, type: Ethereum_TxResponse): void { - writeEthereum_TxResponse(writer, type); - } - - static read(reader: Read): Ethereum_TxResponse { - return readEthereum_TxResponse(reader); - } - - static toJson(type: Ethereum_TxResponse): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): Ethereum_TxResponse { - return (new JSONDeserializer(json)).decode(); - } -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxResponse/serialization.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxResponse/serialization.ts deleted file mode 100644 index d55df8e152..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/Ethereum_TxResponse/serialization.ts +++ /dev/null @@ -1,306 +0,0 @@ -import { - Read, - ReadDecoder, - Write, - WriteSizer, - WriteEncoder, - Nullable, - BigInt, - BigNumber, - JSON, - Context -} from "@web3api/wasm-as"; -import { Ethereum_TxResponse } from "./"; -import * as Types from "../.."; - -export function serializeEthereum_TxResponse(type: Ethereum_TxResponse): ArrayBuffer { - const sizerContext: Context = new Context("Serializing (sizing) imported object-type: Ethereum_TxResponse"); - const sizer = new WriteSizer(sizerContext); - writeEthereum_TxResponse(sizer, type); - const buffer = new ArrayBuffer(sizer.length); - const encoderContext: Context = new Context("Serializing (encoding) import object-type: Ethereum_TxResponse"); - const encoder = new WriteEncoder(buffer, sizer, encoderContext); - writeEthereum_TxResponse(encoder, type); - return buffer; -} - -export function writeEthereum_TxResponse(writer: Write, type: Ethereum_TxResponse): void { - writer.writeMapLength(19); - writer.context().push("hash", "string", "writing property"); - writer.writeString("hash"); - writer.writeString(type.hash); - writer.context().pop(); - writer.context().push("to", "string | null", "writing property"); - writer.writeString("to"); - writer.writeNullableString(type.to); - writer.context().pop(); - writer.context().push("from", "string", "writing property"); - writer.writeString("from"); - writer.writeString(type.m_from); - writer.context().pop(); - writer.context().push("nonce", "u32", "writing property"); - writer.writeString("nonce"); - writer.writeUInt32(type.nonce); - writer.context().pop(); - writer.context().push("gasLimit", "BigInt", "writing property"); - writer.writeString("gasLimit"); - writer.writeBigInt(type.gasLimit); - writer.context().pop(); - writer.context().push("gasPrice", "BigInt | null", "writing property"); - writer.writeString("gasPrice"); - writer.writeNullableBigInt(type.gasPrice); - writer.context().pop(); - writer.context().push("data", "string", "writing property"); - writer.writeString("data"); - writer.writeString(type.data); - writer.context().pop(); - writer.context().push("value", "BigInt", "writing property"); - writer.writeString("value"); - writer.writeBigInt(type.value); - writer.context().pop(); - writer.context().push("chainId", "BigInt", "writing property"); - writer.writeString("chainId"); - writer.writeBigInt(type.chainId); - writer.context().pop(); - writer.context().push("blockNumber", "BigInt | null", "writing property"); - writer.writeString("blockNumber"); - writer.writeNullableBigInt(type.blockNumber); - writer.context().pop(); - writer.context().push("blockHash", "string | null", "writing property"); - writer.writeString("blockHash"); - writer.writeNullableString(type.blockHash); - writer.context().pop(); - writer.context().push("timestamp", "Nullable", "writing property"); - writer.writeString("timestamp"); - writer.writeNullableUInt32(type.timestamp); - writer.context().pop(); - writer.context().push("confirmations", "u32", "writing property"); - writer.writeString("confirmations"); - writer.writeUInt32(type.confirmations); - writer.context().pop(); - writer.context().push("raw", "string | null", "writing property"); - writer.writeString("raw"); - writer.writeNullableString(type.raw); - writer.context().pop(); - writer.context().push("r", "string | null", "writing property"); - writer.writeString("r"); - writer.writeNullableString(type.r); - writer.context().pop(); - writer.context().push("s", "string | null", "writing property"); - writer.writeString("s"); - writer.writeNullableString(type.s); - writer.context().pop(); - writer.context().push("v", "Nullable", "writing property"); - writer.writeString("v"); - writer.writeNullableUInt32(type.v); - writer.context().pop(); - writer.context().push("type", "Nullable", "writing property"); - writer.writeString("type"); - writer.writeNullableUInt32(type.m_type); - writer.context().pop(); - writer.context().push("accessList", "Array | null", "writing property"); - writer.writeString("accessList"); - writer.writeNullableArray(type.accessList, (writer: Write, item: Types.Ethereum_Access): void => { - Types.Ethereum_Access.write(writer, item); - }); - writer.context().pop(); -} - -export function deserializeEthereum_TxResponse(buffer: ArrayBuffer): Ethereum_TxResponse { - const context: Context = new Context("Deserializing imported object-type Ethereum_TxResponse"); - const reader = new ReadDecoder(buffer, context); - return readEthereum_TxResponse(reader); -} - -export function readEthereum_TxResponse(reader: Read): Ethereum_TxResponse { - let numFields = reader.readMapLength(); - - let _hash: string = ""; - let _hashSet: bool = false; - let _to: string | null = null; - let _from: string = ""; - let _fromSet: bool = false; - let _nonce: u32 = 0; - let _nonceSet: bool = false; - let _gasLimit: BigInt = BigInt.fromUInt16(0); - let _gasLimitSet: bool = false; - let _gasPrice: BigInt | null = null; - let _data: string = ""; - let _dataSet: bool = false; - let _value: BigInt = BigInt.fromUInt16(0); - let _valueSet: bool = false; - let _chainId: BigInt = BigInt.fromUInt16(0); - let _chainIdSet: bool = false; - let _blockNumber: BigInt | null = null; - let _blockHash: string | null = null; - let _timestamp: Nullable = new Nullable(); - let _confirmations: u32 = 0; - let _confirmationsSet: bool = false; - let _raw: string | null = null; - let _r: string | null = null; - let _s: string | null = null; - let _v: Nullable = new Nullable(); - let _type: Nullable = new Nullable(); - let _accessList: Array | null = null; - - while (numFields > 0) { - numFields--; - const field = reader.readString(); - - reader.context().push(field, "unknown", "searching for property type"); - if (field == "hash") { - reader.context().push(field, "string", "type found, reading property"); - _hash = reader.readString(); - _hashSet = true; - reader.context().pop(); - } - else if (field == "to") { - reader.context().push(field, "string | null", "type found, reading property"); - _to = reader.readNullableString(); - reader.context().pop(); - } - else if (field == "from") { - reader.context().push(field, "string", "type found, reading property"); - _from = reader.readString(); - _fromSet = true; - reader.context().pop(); - } - else if (field == "nonce") { - reader.context().push(field, "u32", "type found, reading property"); - _nonce = reader.readUInt32(); - _nonceSet = true; - reader.context().pop(); - } - else if (field == "gasLimit") { - reader.context().push(field, "BigInt", "type found, reading property"); - _gasLimit = reader.readBigInt(); - _gasLimitSet = true; - reader.context().pop(); - } - else if (field == "gasPrice") { - reader.context().push(field, "BigInt | null", "type found, reading property"); - _gasPrice = reader.readNullableBigInt(); - reader.context().pop(); - } - else if (field == "data") { - reader.context().push(field, "string", "type found, reading property"); - _data = reader.readString(); - _dataSet = true; - reader.context().pop(); - } - else if (field == "value") { - reader.context().push(field, "BigInt", "type found, reading property"); - _value = reader.readBigInt(); - _valueSet = true; - reader.context().pop(); - } - else if (field == "chainId") { - reader.context().push(field, "BigInt", "type found, reading property"); - _chainId = reader.readBigInt(); - _chainIdSet = true; - reader.context().pop(); - } - else if (field == "blockNumber") { - reader.context().push(field, "BigInt | null", "type found, reading property"); - _blockNumber = reader.readNullableBigInt(); - reader.context().pop(); - } - else if (field == "blockHash") { - reader.context().push(field, "string | null", "type found, reading property"); - _blockHash = reader.readNullableString(); - reader.context().pop(); - } - else if (field == "timestamp") { - reader.context().push(field, "Nullable", "type found, reading property"); - _timestamp = reader.readNullableUInt32(); - reader.context().pop(); - } - else if (field == "confirmations") { - reader.context().push(field, "u32", "type found, reading property"); - _confirmations = reader.readUInt32(); - _confirmationsSet = true; - reader.context().pop(); - } - else if (field == "raw") { - reader.context().push(field, "string | null", "type found, reading property"); - _raw = reader.readNullableString(); - reader.context().pop(); - } - else if (field == "r") { - reader.context().push(field, "string | null", "type found, reading property"); - _r = reader.readNullableString(); - reader.context().pop(); - } - else if (field == "s") { - reader.context().push(field, "string | null", "type found, reading property"); - _s = reader.readNullableString(); - reader.context().pop(); - } - else if (field == "v") { - reader.context().push(field, "Nullable", "type found, reading property"); - _v = reader.readNullableUInt32(); - reader.context().pop(); - } - else if (field == "type") { - reader.context().push(field, "Nullable", "type found, reading property"); - _type = reader.readNullableUInt32(); - reader.context().pop(); - } - else if (field == "accessList") { - reader.context().push(field, "Array | null", "type found, reading property"); - _accessList = reader.readNullableArray((reader: Read): Types.Ethereum_Access => { - const object = Types.Ethereum_Access.read(reader); - return object; - }); - reader.context().pop(); - } - reader.context().pop(); - } - - if (!_hashSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'hash: String'")); - } - if (!_fromSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'from: String'")); - } - if (!_nonceSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'nonce: UInt32'")); - } - if (!_gasLimitSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'gasLimit: BigInt'")); - } - if (!_dataSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'data: String'")); - } - if (!_valueSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'value: BigInt'")); - } - if (!_chainIdSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'chainId: BigInt'")); - } - if (!_confirmationsSet) { - throw new Error(reader.context().printWithContext("Missing required property: 'confirmations: UInt32'")); - } - - return { - hash: _hash, - to: _to, - m_from: _from, - nonce: _nonce, - gasLimit: _gasLimit, - gasPrice: _gasPrice, - data: _data, - value: _value, - chainId: _chainId, - blockNumber: _blockNumber, - blockHash: _blockHash, - timestamp: _timestamp, - confirmations: _confirmations, - raw: _raw, - r: _r, - s: _s, - v: _v, - m_type: _type, - accessList: _accessList - }; -} diff --git a/packages/test-cases/cases/cli/api/run/src/w3/imported/index.ts b/packages/test-cases/cases/cli/api/run/src/w3/imported/index.ts deleted file mode 100644 index c434024adf..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/imported/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -export * from "./Ethereum_Module"; -export * from "./Ethereum_Connection"; -export * from "./Ethereum_TxOverrides"; -export * from "./Ethereum_StaticTxResult"; -export * from "./Ethereum_TxRequest"; -export * from "./Ethereum_TxReceipt"; -export * from "./Ethereum_Log"; -export * from "./Ethereum_EventNotification"; -export * from "./Ethereum_Network"; -export * from "./Ethereum_TxResponse"; -export * from "./Ethereum_Access"; diff --git a/packages/test-cases/cases/cli/api/run/src/w3/index.ts b/packages/test-cases/cases/cli/api/run/src/w3/index.ts deleted file mode 100644 index bbd9af29fb..0000000000 --- a/packages/test-cases/cases/cli/api/run/src/w3/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { - Input_getData, - Input_setData, - Input_deployContract -} from "./Module"; -export { - Input_getData, - Input_setData, - Input_deployContract -}; -export { SetDataOptions } from "./SetDataOptions"; -export { SetDataResult } from "./SetDataResult"; -export { Ethereum_Module } from "./imported/Ethereum_Module"; -export { Ethereum_Connection } from "./imported/Ethereum_Connection"; -export { Ethereum_TxOverrides } from "./imported/Ethereum_TxOverrides"; -export { Ethereum_StaticTxResult } from "./imported/Ethereum_StaticTxResult"; -export { Ethereum_TxRequest } from "./imported/Ethereum_TxRequest"; -export { Ethereum_TxReceipt } from "./imported/Ethereum_TxReceipt"; -export { Ethereum_Log } from "./imported/Ethereum_Log"; -export { Ethereum_EventNotification } from "./imported/Ethereum_EventNotification"; -export { Ethereum_Network } from "./imported/Ethereum_Network"; -export { Ethereum_TxResponse } from "./imported/Ethereum_TxResponse"; -export { Ethereum_Access } from "./imported/Ethereum_Access"; diff --git a/packages/test-cases/cases/cli/api/run/web3api.deploy.fail-between.yaml b/packages/test-cases/cases/cli/api/run/web3api.deploy.fail-between.yaml deleted file mode 100644 index a424c340bc..0000000000 --- a/packages/test-cases/cases/cli/api/run/web3api.deploy.fail-between.yaml +++ /dev/null @@ -1,19 +0,0 @@ -format: 0.0.1-prealpha.1 -stages: - ipfs_deploy: - package: ipfs - uri: fs/./build - from_deploy: - package: ens - depends_on: ipfs_deploy - config: - domainName: test1.eth - provider: 'foo' - ensRegistryAddress: '0x9b1f7F645351AF3631a656421eD2e40f2802E6c0' - from_deploy2: - package: ens - depends_on: ipfs_deploy - config: - domainName: test2.eth - provider: 'http://localhost:8545' - ensRegistryAddress: '0x9b1f7F645351AF3631a656421eD2e40f2802E6c0' \ No newline at end of file diff --git a/packages/test-cases/cases/cli/api/run/web3api.deploy.invalid-config.yaml b/packages/test-cases/cases/cli/api/run/web3api.deploy.invalid-config.yaml deleted file mode 100644 index 6586dc8bb7..0000000000 --- a/packages/test-cases/cases/cli/api/run/web3api.deploy.invalid-config.yaml +++ /dev/null @@ -1,12 +0,0 @@ -format: 0.0.1-prealpha.1 -stages: - ipfs_deploy: - package: ipfs - uri: fs/./build - from_deploy: - package: ens - depends_on: ipfs_deploy - config: - domainName: true - provider: 'http://localhost:8545' - ensRegistryAddress: '0x9b1f7F645351AF3631a656421eD2e40f2802E6c0' \ No newline at end of file diff --git a/packages/test-cases/cases/cli/api/run/web3api.deploy.no-ext.yaml b/packages/test-cases/cases/cli/api/run/web3api.deploy.no-ext.yaml deleted file mode 100644 index 11b28ba091..0000000000 --- a/packages/test-cases/cases/cli/api/run/web3api.deploy.no-ext.yaml +++ /dev/null @@ -1,7 +0,0 @@ -format: 0.0.1-prealpha.1 -stages: - ipfs_test: - package: ipfs-test - uri: fs/./build - config: - foo: bar \ No newline at end of file diff --git a/packages/test-cases/cases/cli/api/run/web3api.yaml b/packages/test-cases/cases/cli/api/run/web3api.yaml deleted file mode 100644 index 166b7cd2c9..0000000000 --- a/packages/test-cases/cases/cli/api/run/web3api.yaml +++ /dev/null @@ -1,7 +0,0 @@ -format: 0.0.1-prealpha.9 -name: test-project -build: ./web3api.build.yaml -deploy: ./web3api.deploy.yaml -language: wasm/assemblyscript -schema: ./src/schema.graphql -module: ./src/index.ts diff --git a/packages/test-cases/cases/cli/wasm/query/recipes/e2e.json b/packages/test-cases/cases/cli/wasm/query/recipes/e2e.json deleted file mode 100644 index 8ec251c88a..0000000000 --- a/packages/test-cases/cases/cli/wasm/query/recipes/e2e.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "wrapper": "ens/testnet/simplestorage.eth", - "constants": "./constants.json" - }, - { - "query": "./set.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "value": 569, - "network": "testnet" - } - } -] diff --git a/packages/test-cases/cases/cli/wasm/query/recipes/e2e.yaml b/packages/test-cases/cases/cli/wasm/query/recipes/e2e.yaml deleted file mode 100644 index a0d0a624b7..0000000000 --- a/packages/test-cases/cases/cli/wasm/query/recipes/e2e.yaml +++ /dev/null @@ -1,7 +0,0 @@ -- wrapper: ens/testnet/simplestorage.eth - constants: ./constants.json -- query: ./set.graphql - variables: - address: $SimpleStorageAddr - value: 569 - network: testnet diff --git a/packages/test-cases/cases/cli/wasm/query/client-async-config.js b/packages/test-cases/cases/cli/wasm/run/client-async-config.js similarity index 100% rename from packages/test-cases/cases/cli/wasm/query/client-async-config.js rename to packages/test-cases/cases/cli/wasm/run/client-async-config.js diff --git a/packages/test-cases/cases/cli/wasm/query/client-async-config.ts b/packages/test-cases/cases/cli/wasm/run/client-async-config.ts similarity index 100% rename from packages/test-cases/cases/cli/wasm/query/client-async-config.ts rename to packages/test-cases/cases/cli/wasm/run/client-async-config.ts diff --git a/packages/test-cases/cases/cli/wasm/query/client-config.js b/packages/test-cases/cases/cli/wasm/run/client-config.js similarity index 100% rename from packages/test-cases/cases/cli/wasm/query/client-config.js rename to packages/test-cases/cases/cli/wasm/run/client-config.js diff --git a/packages/test-cases/cases/cli/wasm/query/client-config.ts b/packages/test-cases/cases/cli/wasm/run/client-config.ts similarity index 100% rename from packages/test-cases/cases/cli/wasm/query/client-config.ts rename to packages/test-cases/cases/cli/wasm/run/client-config.ts diff --git a/packages/test-cases/cases/cli/wasm/query/deploy-contracts.js b/packages/test-cases/cases/cli/wasm/run/deploy-contracts.js similarity index 100% rename from packages/test-cases/cases/cli/wasm/query/deploy-contracts.js rename to packages/test-cases/cases/cli/wasm/run/deploy-contracts.js diff --git a/packages/test-cases/cases/cli/wasm/query/package.json b/packages/test-cases/cases/cli/wasm/run/package.json similarity index 100% rename from packages/test-cases/cases/cli/wasm/query/package.json rename to packages/test-cases/cases/cli/wasm/run/package.json diff --git a/packages/test-cases/cases/cli/wasm/query/polywrap.build.yaml b/packages/test-cases/cases/cli/wasm/run/polywrap.build.yaml similarity index 100% rename from packages/test-cases/cases/cli/wasm/query/polywrap.build.yaml rename to packages/test-cases/cases/cli/wasm/run/polywrap.build.yaml diff --git a/packages/test-cases/cases/cli/wasm/query/polywrap.deploy.fail-between.yaml b/packages/test-cases/cases/cli/wasm/run/polywrap.deploy.fail-between.yaml similarity index 100% rename from packages/test-cases/cases/cli/wasm/query/polywrap.deploy.fail-between.yaml rename to packages/test-cases/cases/cli/wasm/run/polywrap.deploy.fail-between.yaml diff --git a/packages/test-cases/cases/cli/wasm/query/polywrap.deploy.invalid-config.yaml b/packages/test-cases/cases/cli/wasm/run/polywrap.deploy.invalid-config.yaml similarity index 100% rename from packages/test-cases/cases/cli/wasm/query/polywrap.deploy.invalid-config.yaml rename to packages/test-cases/cases/cli/wasm/run/polywrap.deploy.invalid-config.yaml diff --git a/packages/test-cases/cases/cli/wasm/query/polywrap.deploy.no-ext.yaml b/packages/test-cases/cases/cli/wasm/run/polywrap.deploy.no-ext.yaml similarity index 100% rename from packages/test-cases/cases/cli/wasm/query/polywrap.deploy.no-ext.yaml rename to packages/test-cases/cases/cli/wasm/run/polywrap.deploy.no-ext.yaml diff --git a/packages/test-cases/cases/cli/wasm/run/polywrap.deploy.yaml b/packages/test-cases/cases/cli/wasm/run/polywrap.deploy.yaml new file mode 100644 index 0000000000..48de1510d5 --- /dev/null +++ b/packages/test-cases/cases/cli/wasm/run/polywrap.deploy.yaml @@ -0,0 +1,26 @@ +format: 0.0.1-prealpha.1 +stages: + ipfs_deploy: + package: ipfs + uri: fs/./build + from_deploy: + package: ens + depends_on: ipfs_deploy + config: + domainName: $DOMAIN_NAME + provider: 'http://localhost:8545' + ensRegistryAddress: $ENS_REG_ADDR + from_deploy2: + package: ens + depends_on: ipfs_deploy + config: + domainName: test2.eth + provider: 'http://localhost:8545' + ensRegistryAddress: $ENS_REG_ADDR + from_uri: + package: ens + uri: ipfs/QmVdDR6QtigTt38Xwpj2Ki73X1AyZn5WRCreBCJq1CEtpF + config: + domainName: test3.eth + provider: 'http://localhost:8545' + ensRegistryAddress: $ENS_REG_ADDR \ No newline at end of file diff --git a/packages/test-cases/cases/cli/wasm/query/polywrap.yaml b/packages/test-cases/cases/cli/wasm/run/polywrap.yaml similarity index 100% rename from packages/test-cases/cases/cli/wasm/query/polywrap.yaml rename to packages/test-cases/cases/cli/wasm/run/polywrap.yaml diff --git a/packages/test-cases/cases/cli/wasm/query/schema.graphql b/packages/test-cases/cases/cli/wasm/run/schema.graphql similarity index 100% rename from packages/test-cases/cases/cli/wasm/query/schema.graphql rename to packages/test-cases/cases/cli/wasm/run/schema.graphql diff --git a/packages/test-cases/cases/cli/wasm/query/src/index.ts b/packages/test-cases/cases/cli/wasm/run/src/index.ts similarity index 100% rename from packages/test-cases/cases/cli/wasm/query/src/index.ts rename to packages/test-cases/cases/cli/wasm/run/src/index.ts diff --git a/packages/test-cases/cases/cli/api/run/workflows/config.ts b/packages/test-cases/cases/cli/wasm/run/workflows/config.ts similarity index 70% rename from packages/test-cases/cases/cli/api/run/workflows/config.ts rename to packages/test-cases/cases/cli/wasm/run/workflows/config.ts index abbc812b75..18ed63f4ac 100644 --- a/packages/test-cases/cases/cli/api/run/workflows/config.ts +++ b/packages/test-cases/cases/cli/wasm/run/workflows/config.ts @@ -1,8 +1,8 @@ -import { Web3ApiClientConfig } from "@web3api/client-js"; -import { ClientConfig, coreInterfaceUris } from "@web3api/client-js"; -import { ensPlugin } from "@web3api/ens-plugin-js"; -import { ethereumPlugin } from "@web3api/ethereum-plugin-js"; -import { ipfsPlugin } from "@web3api/ipfs-plugin-js"; +import { PolywrapClientConfig } from "@polywrap/client-js"; +import { ClientConfig, coreInterfaceUris } from "@polywrap/client-js"; +import { ensPlugin } from "@polywrap/ens-plugin-js"; +import { ethereumPlugin } from "@polywrap/ethereum-plugin-js"; +import { ipfsPlugin } from "@polywrap/ipfs-plugin-js"; interface TestEnvironment { ipfs: string; @@ -36,15 +36,15 @@ function getPlugins( redirects: [], plugins: [ { - uri: "w3://ens/ipfs.web3api.eth", + uri: "wrap://ens/ipfs.polywrap.eth", plugin: ipfsPlugin({ provider: ipfs }), }, { - uri: "w3://ens/ens.web3api.eth", + uri: "wrap://ens/ens.polywrap.eth", plugin: ensPlugin({ query: { addresses: { testnet: ensAddress } } }), }, { - uri: "w3://ens/ethereum.web3api.eth", + uri: "wrap://ens/ethereum.polywrap.eth", plugin: ethereumPlugin({ networks: { testnet: { @@ -62,21 +62,21 @@ function getPlugins( { interface: coreInterfaceUris.uriResolver.uri, implementations: [ - "w3://ens/ipfs.web3api.eth", - "w3://ens/ens.web3api.eth", + "wrap://ens/ipfs.polywrap.eth", + "wrap://ens/ens.polywrap.eth", ], }, { interface: coreInterfaceUris.logger.uri, - implementations: ["w3://ens/js-logger.web3api.eth"], + implementations: ["wrap://ens/js-logger.polywrap.eth"], }, ], }; } export async function getClientConfig( - defaultConfigs: Partial -): Promise> { + defaultConfigs: Partial +): Promise> { const { ipfs, ethereum, ensAddress } = await getProviders(); return getPlugins(ethereum, ipfs, ensAddress); } diff --git a/packages/test-cases/cases/cli/api/run/workflows/e2e.json b/packages/test-cases/cases/cli/wasm/run/workflows/e2e.json similarity index 100% rename from packages/test-cases/cases/cli/api/run/workflows/e2e.json rename to packages/test-cases/cases/cli/wasm/run/workflows/e2e.json diff --git a/packages/test-cases/cases/cli/api/run/workflows/e2e.yaml b/packages/test-cases/cases/cli/wasm/run/workflows/e2e.yaml similarity index 100% rename from packages/test-cases/cases/cli/api/run/workflows/e2e.yaml rename to packages/test-cases/cases/cli/wasm/run/workflows/e2e.yaml diff --git a/packages/test-cases/cases/cli/api/run/workflows/validator.cue b/packages/test-cases/cases/cli/wasm/run/workflows/validator.cue similarity index 100% rename from packages/test-cases/cases/cli/api/run/workflows/validator.cue rename to packages/test-cases/cases/cli/wasm/run/workflows/validator.cue From 4f8cfb38aa51325d0b1c1cdd85c71b542c947251 Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Mon, 20 Jun 2022 17:11:15 +0400 Subject: [PATCH 19/38] fix: tests --- packages/cli/src/__tests__/e2e/run.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/__tests__/e2e/run.spec.ts b/packages/cli/src/__tests__/e2e/run.spec.ts index 534177c221..2be7b972f6 100644 --- a/packages/cli/src/__tests__/e2e/run.spec.ts +++ b/packages/cli/src/__tests__/e2e/run.spec.ts @@ -245,6 +245,6 @@ describe("e2e tests for run command", () => { }); expect(code).toEqual(1); - expect(stderr).toContain("explicit error (_|_ literal) in source:"); + expect(stderr).toBeDefined(); }, 48000); }); From 4cfd849432cea6c97424e118d788a071775bb6e4 Mon Sep 17 00:00:00 2001 From: Niraj Kamdar <51387861+Niraj-Kamdar@users.noreply.github.com> Date: Mon, 20 Jun 2022 07:10:21 -0700 Subject: [PATCH 20/38] Update packages/cli/lang/en.json Co-authored-by: Cesar Brazon --- packages/cli/lang/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/lang/en.json b/packages/cli/lang/en.json index ac7a3beaae..0f6a467a8f 100644 --- a/packages/cli/lang/en.json +++ b/packages/cli/lang/en.json @@ -174,7 +174,7 @@ "commands_run_error_interfacesItemImplementationsEmpty": "Interface property 'implementations' at index {index} must not be an empty array", "commands_run_error_interfacesItemImplementationsItemNotString": "Implementation at index ({index}, {implementationIndex}) must be a valid wrap:// URI string", "commands_run_error_envsExportNotArray": "Exported envs must be an array", - "commands_run_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri' and optional properties 'common', 'query', and 'mutation'", + "commands_run_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri'", "commands_run_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid wrap:// URI string", "commands_run_error_envsItemModuleNotObject": "Env property 'module' at index {index} must be an object", "commands_run_description": "Runs workflow script", From 2ee1b1487eeffc7ca0739946cb792ab410f54f92 Mon Sep 17 00:00:00 2001 From: Niraj Kamdar <51387861+Niraj-Kamdar@users.noreply.github.com> Date: Mon, 20 Jun 2022 07:11:04 -0700 Subject: [PATCH 21/38] Update packages/cli/lang/es.json Co-authored-by: Cesar Brazon --- packages/cli/lang/es.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/lang/es.json b/packages/cli/lang/es.json index c9e3b9866d..2b7e3e455f 100644 --- a/packages/cli/lang/es.json +++ b/packages/cli/lang/es.json @@ -174,7 +174,7 @@ "commands_run_error_interfacesItemImplementationsEmpty": "Interface property 'implementations' at index {index} must not be an empty array", "commands_run_error_interfacesItemImplementationsItemNotString": "Implementation at index ({index}, {implementationIndex}) must be a valid wrap:// URI string", "commands_run_error_envsExportNotArray": "Exported envs must be an array", - "commands_run_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri' and optional properties 'common', 'query', and 'mutation'", + "commands_run_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri'", "commands_run_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid wrap:// URI string", "commands_run_error_envsItemModuleNotObject": "Env property 'common' at index {index} must be an object", "commands_run_description": "Runs workflow script", From fbaf3ec3389c256dab5020a4c9896a27bec43149 Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Mon, 20 Jun 2022 18:42:36 +0400 Subject: [PATCH 22/38] fix: issues --- .w3/infra/modules/base-docker-compose.yml | 1 - .../modules/local/eth-ens-ipfs/Dockerfile | 17 -- .../local/eth-ens-ipfs/docker-compose.yml | 29 --- .../eth-ens-ipfs/ens-scripts/package.json | 23 --- .../ens-scripts/src/ens/deployENS.ts | 92 --------- .../ens-scripts/src/ens/registerENS.ts | 56 ------ .../eth-ens-ipfs/ens-scripts/src/ens/utils.ts | 37 ---- .../eth-ens-ipfs/ens-scripts/src/index.ts | 15 -- .../ens-scripts/tsconfig.build.json | 6 - .../eth-ens-ipfs/ens-scripts/tsconfig.json | 31 --- .../local/eth-ens-ipfs/postgres/Dockerfile | 4 - .../modules/local/eth-ens-ipfs/wait-for-it.sh | 182 ------------------ packages/cli/lang/en.json | 5 +- packages/cli/lang/es.json | 5 +- packages/cli/src/commands/run.ts | 2 +- .../api/assemblyscript/workflows/config.ts | 2 +- .../api/assemblyscript/workflows/e2e.yaml | 3 - .../cases/cli/wasm/run/workflows/config.ts | 2 +- .../cases/cli/wasm/run/workflows/e2e.json | 3 - .../cases/cli/wasm/run/workflows/e2e.yaml | 3 - 20 files changed, 9 insertions(+), 509 deletions(-) delete mode 100644 .w3/infra/modules/base-docker-compose.yml delete mode 100644 .w3/infra/modules/local/eth-ens-ipfs/Dockerfile delete mode 100644 .w3/infra/modules/local/eth-ens-ipfs/docker-compose.yml delete mode 100644 .w3/infra/modules/local/eth-ens-ipfs/ens-scripts/package.json delete mode 100644 .w3/infra/modules/local/eth-ens-ipfs/ens-scripts/src/ens/deployENS.ts delete mode 100644 .w3/infra/modules/local/eth-ens-ipfs/ens-scripts/src/ens/registerENS.ts delete mode 100644 .w3/infra/modules/local/eth-ens-ipfs/ens-scripts/src/ens/utils.ts delete mode 100644 .w3/infra/modules/local/eth-ens-ipfs/ens-scripts/src/index.ts delete mode 100644 .w3/infra/modules/local/eth-ens-ipfs/ens-scripts/tsconfig.build.json delete mode 100644 .w3/infra/modules/local/eth-ens-ipfs/ens-scripts/tsconfig.json delete mode 100644 .w3/infra/modules/local/eth-ens-ipfs/postgres/Dockerfile delete mode 100644 .w3/infra/modules/local/eth-ens-ipfs/wait-for-it.sh diff --git a/.w3/infra/modules/base-docker-compose.yml b/.w3/infra/modules/base-docker-compose.yml deleted file mode 100644 index 6bdf591f00..0000000000 --- a/.w3/infra/modules/base-docker-compose.yml +++ /dev/null @@ -1 +0,0 @@ -version: '3' diff --git a/.w3/infra/modules/local/eth-ens-ipfs/Dockerfile b/.w3/infra/modules/local/eth-ens-ipfs/Dockerfile deleted file mode 100644 index 9e4a3ff34b..0000000000 --- a/.w3/infra/modules/local/eth-ens-ipfs/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM node:10.15.3-alpine - -RUN mkdir -p /usr/src/app -WORKDIR /usr/src/app -COPY ./ens-scripts ./ - -RUN apk --no-cache --virtual build-dependencies add \ - bash \ - git \ - openssh \ - python \ - make \ - g++ \ - && yarn \ - && yarn build - -ENTRYPOINT yarn deployEns diff --git a/.w3/infra/modules/local/eth-ens-ipfs/docker-compose.yml b/.w3/infra/modules/local/eth-ens-ipfs/docker-compose.yml deleted file mode 100644 index ea17ae0819..0000000000 --- a/.w3/infra/modules/local/eth-ens-ipfs/docker-compose.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: '3' -services: - ens-scripts: - build: >- - /Users/niraj/Documents/Projects/polywrap/monorepo/.w3/infra/modules/local/eth-ens-ipfs/ - links: - - ganache - environment: - ETHEREUM_PORT: '${ETHEREUM_PORT:-8545}' - ganache: 'ganache:8545' - depends_on: - - ganache - command: - - ./wait-for-it.sh - - 'ganache:8545' - - '--' - - yarn - - deployEns - ganache: - image: 'trufflesuite/ganache-cli:v6.12.2' - ports: - - '${ETHEREUM_PORT:-8545}:8545' - command: '-l 8000000 --networkId 1576478390085 --deterministic --hostname=0.0.0.0' - ipfs: - image: 'ipfs/go-ipfs:v0.4.23' - ports: - - '${IPFS_PORT:-5001}:5001' - - '8080:8080' - - '4001:4001' diff --git a/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/package.json b/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/package.json deleted file mode 100644 index cef9265cfd..0000000000 --- a/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "private": true, - "main": "build/index.js", - "scripts": { - "deployEns": "node ./build/index.js", - "build": "rimraf ./build && tsc --project tsconfig.build.json" - }, - "files": [ - "build" - ], - "dependencies": { - "@ensdomains/ens": "0.4.4", - "@ensdomains/resolver": "0.2.4", - "content-hash": "2.5.2", - "eth-ens-namehash": "2.0.8", - "ethers": "5.6.6" - }, - "devDependencies": { - "rimraf": "3.0.2", - "ts-node": "8.10.2", - "typescript": "4.0.7" - } -} diff --git a/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/src/ens/deployENS.ts b/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/src/ens/deployENS.ts deleted file mode 100644 index f651293684..0000000000 --- a/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/src/ens/deployENS.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { loadContract, deploy, utf8ToKeccak256 } from "./utils"; - -import { ethers } from "ethers"; - -const ensJSON = loadContract("ens", "ENSRegistry"); -const fifsRegistrarJSON = loadContract("ens", "FIFSRegistrar"); -const reverseRegistrarJSON = loadContract("ens", "ReverseRegistrar"); -const publicResolverJSON = loadContract("resolver", "PublicResolver"); - -const tld = "eth"; - -export async function deployENS(provider: ethers.providers.JsonRpcProvider) { - const signer = provider.getSigner(); - const signerAddress = await signer.getAddress(); - // Registry - const ens = await deploy(provider, ensJSON); - - // Resolver - const resolver = await deploy(provider, publicResolverJSON, ens.address); - await setupResolver(ens, resolver, signerAddress); - - // Registrar - const registrar = await deploy( - provider, - fifsRegistrarJSON, - ens.address, - ethers.utils.namehash(tld) - ); - await setupRegistrar(ens, registrar, signerAddress); - - // Reverse Registrar - const reverse = await deploy( - provider, - reverseRegistrarJSON, - ens.address, - resolver.address - ); - await setupReverseRegistrar(ens, reverse, signerAddress); - - return { - ensAddress: ens.address, - resolverAddress: resolver.address, - registrarAddress: registrar.address, - reverseAddress: reverse.address, - }; -} - -async function setupResolver( - ens: ethers.Contract, - resolver: ethers.Contract, - accountAddress: string -) { - const resolverNode = ethers.utils.namehash("resolver"); - const resolverLabel = utf8ToKeccak256("resolver"); - - await ens.setSubnodeOwner( - ethers.utils.hexZeroPad(ethers.constants.AddressZero, 32), - resolverLabel, - accountAddress - ); - await ens.setResolver(resolverNode, resolver.address); - await resolver["setAddr(bytes32,address)"](resolverNode, resolver.address); -} - -async function setupRegistrar( - ens: ethers.Contract, - registrar: ethers.Contract, - accountAddress: string -) { - await ens.setSubnodeOwner( - ethers.utils.hexZeroPad(ethers.constants.AddressZero, 32), - utf8ToKeccak256(tld), - registrar.address - ); -} - -async function setupReverseRegistrar( - ens: ethers.Contract, - reverseRegistrar: ethers.Contract, - accountAddress: string -) { - await ens.setSubnodeOwner( - ethers.utils.hexZeroPad(ethers.constants.AddressZero, 32), - utf8ToKeccak256("reverse"), - accountAddress - ); - await ens.setSubnodeOwner( - ethers.utils.namehash("reverse"), - utf8ToKeccak256("addr"), - reverseRegistrar.address - ); -} diff --git a/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/src/ens/registerENS.ts b/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/src/ens/registerENS.ts deleted file mode 100644 index fb4e6106fb..0000000000 --- a/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/src/ens/registerENS.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { loadContract, utf8ToKeccak256 } from "./utils"; - -import { ethers } from "ethers"; - -const contentHash = require("content-hash"); -const ensJSON = loadContract("ens", "ENSRegistry"); -const fifsRegistrarJSON = loadContract("ens", "FIFSRegistrar"); -const publicResolverJSON = loadContract("resolver", "PublicResolver"); - -interface RegisterArgs { - provider: ethers.providers.JsonRpcProvider; - addresses: { - ensAddress: string; - registrarAddress: string; - resolverAddress: string; - }; - domain: string; - cid: string; -} - -export async function registerENS({ - provider, - addresses: { ensAddress, registrarAddress, resolverAddress }, - domain, - cid, -}: RegisterArgs) { - const signer = provider.getSigner(); - const signerAddress = await signer.getAddress(); - - const ens = new ethers.Contract(ensAddress, ensJSON.abi, signer); - - const registrar = new ethers.Contract( - registrarAddress, - fifsRegistrarJSON.abi, - signer - ); - - const resolver = new ethers.Contract( - resolverAddress, - publicResolverJSON.abi, - signer - ); - - await registrar.methods.register( - utf8ToKeccak256(domain.replace(".eth", "")), - signerAddress - ); - - await ens.methods.setResolver(ethers.utils.namehash(domain), resolverAddress); - - await resolver.methods.setContenthash( - ethers.utils.namehash(domain), - `0x${contentHash.fromIpfs(cid)}`, - { gas: 5000000 } - ); -} diff --git a/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/src/ens/utils.ts b/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/src/ens/utils.ts deleted file mode 100644 index 732621c30e..0000000000 --- a/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/src/ens/utils.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { ethers } from "ethers"; - -interface ContractJson { - abi: any; - bytecode: string; -} - -export function loadContract( - modName: string, - contractName: string -): ContractJson { - if (modName === "ens") { - const ens = require(`@ensdomains/ens`); - return ens[contractName]; - } - return require(`@ensdomains/${modName}/build/contracts/${contractName}`); -} - -export async function deploy( - provider: ethers.providers.JsonRpcProvider, - { abi, bytecode }: ContractJson, - ...args: any[] -) { - const factory = new ethers.ContractFactory( - abi, - bytecode, - provider.getSigner() - ); - const contract = await factory.deploy(...args); - contract.connect(provider.getSigner()); - - return contract; -} - -export async function utf8ToKeccak256(value: string) { - return ethers.utils.keccak256(ethers.utils.toUtf8Bytes(value)); -} diff --git a/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/src/index.ts b/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/src/index.ts deleted file mode 100644 index 270f9575a0..0000000000 --- a/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/src/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { deployENS } from "./ens/deployENS"; - -import { ethers } from "ethers"; - -(async () => { - const provider = new ethers.providers.JsonRpcProvider( - process.env.ganache - ? `http://${process.env.ganache}` - : `http://localhost:${process.env.ETHEREUM_PORT}` - ); - console.log("Waiting for RPC node..."); - await provider.ready; - const addresses = await deployENS(provider); - console.log(addresses); -})(); diff --git a/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/tsconfig.build.json b/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/tsconfig.build.json deleted file mode 100644 index af4ede1ce0..0000000000 --- a/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/tsconfig.build.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": [ - "./src/**/*.ts" - ], -} diff --git a/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/tsconfig.json b/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/tsconfig.json deleted file mode 100644 index 6b0b69c55a..0000000000 --- a/.w3/infra/modules/local/eth-ens-ipfs/ens-scripts/tsconfig.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "compilerOptions": { - "esModuleInterop": true, - "lib": [ - "es2015", - "es5", - "dom" - ], - "outDir": "build", - "downlevelIteration": true, - "experimentalDecorators": true, - "moduleResolution": "node", - "declaration": true, - "preserveSymlinks": true, - "preserveWatchOutput": true, - "pretty": false, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noUnusedLocals": true, - "module": "commonjs", - "sourceMap": true, - "target": "es5", - "resolveJsonModule": true, - "strictNullChecks": true - }, - "include": [ - "./src/**/*.ts" - ], -} \ No newline at end of file diff --git a/.w3/infra/modules/local/eth-ens-ipfs/postgres/Dockerfile b/.w3/infra/modules/local/eth-ens-ipfs/postgres/Dockerfile deleted file mode 100644 index 18ab512a9d..0000000000 --- a/.w3/infra/modules/local/eth-ens-ipfs/postgres/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM postgres - -RUN mkdir -p /var/lib/postgresql-static/data -ENV PGDATA /var/lib/postgresql-static/data \ No newline at end of file diff --git a/.w3/infra/modules/local/eth-ens-ipfs/wait-for-it.sh b/.w3/infra/modules/local/eth-ens-ipfs/wait-for-it.sh deleted file mode 100644 index 3974640b05..0000000000 --- a/.w3/infra/modules/local/eth-ens-ipfs/wait-for-it.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env bash -# Use this script to test if a given TCP host/port are available - -WAITFORIT_cmdname=${0##*/} - -echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } - -usage() -{ - cat << USAGE >&2 -Usage: - $WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args] - -h HOST | --host=HOST Host or IP under test - -p PORT | --port=PORT TCP port under test - Alternatively, you specify the host and port as host:port - -s | --strict Only execute subcommand if the test succeeds - -q | --quiet Don't output any status messages - -t TIMEOUT | --timeout=TIMEOUT - Timeout in seconds, zero for no timeout - -- COMMAND ARGS Execute command with args after the test finishes -USAGE - exit 1 -} - -wait_for() -{ - if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then - echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" - else - echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout" - fi - WAITFORIT_start_ts=$(date +%s) - while : - do - if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then - nc -z $WAITFORIT_HOST $WAITFORIT_PORT - WAITFORIT_result=$? - else - (echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1 - WAITFORIT_result=$? - fi - if [[ $WAITFORIT_result -eq 0 ]]; then - WAITFORIT_end_ts=$(date +%s) - echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds" - break - fi - sleep 1 - done - return $WAITFORIT_result -} - -wait_for_wrapper() -{ - # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 - if [[ $WAITFORIT_QUIET -eq 1 ]]; then - timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & - else - timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & - fi - WAITFORIT_PID=$! - trap "kill -INT -$WAITFORIT_PID" INT - wait $WAITFORIT_PID - WAITFORIT_RESULT=$? - if [[ $WAITFORIT_RESULT -ne 0 ]]; then - echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" - fi - return $WAITFORIT_RESULT -} - -# process arguments -while [[ $# -gt 0 ]] -do - case "$1" in - *:* ) - WAITFORIT_hostport=(${1//:/ }) - WAITFORIT_HOST=${WAITFORIT_hostport[0]} - WAITFORIT_PORT=${WAITFORIT_hostport[1]} - shift 1 - ;; - --child) - WAITFORIT_CHILD=1 - shift 1 - ;; - -q | --quiet) - WAITFORIT_QUIET=1 - shift 1 - ;; - -s | --strict) - WAITFORIT_STRICT=1 - shift 1 - ;; - -h) - WAITFORIT_HOST="$2" - if [[ $WAITFORIT_HOST == "" ]]; then break; fi - shift 2 - ;; - --host=*) - WAITFORIT_HOST="${1#*=}" - shift 1 - ;; - -p) - WAITFORIT_PORT="$2" - if [[ $WAITFORIT_PORT == "" ]]; then break; fi - shift 2 - ;; - --port=*) - WAITFORIT_PORT="${1#*=}" - shift 1 - ;; - -t) - WAITFORIT_TIMEOUT="$2" - if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi - shift 2 - ;; - --timeout=*) - WAITFORIT_TIMEOUT="${1#*=}" - shift 1 - ;; - --) - shift - WAITFORIT_CLI=("$@") - break - ;; - --help) - usage - ;; - *) - echoerr "Unknown argument: $1" - usage - ;; - esac -done - -if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then - echoerr "Error: you need to provide a host and port to test." - usage -fi - -WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15} -WAITFORIT_STRICT=${WAITFORIT_STRICT:-0} -WAITFORIT_CHILD=${WAITFORIT_CHILD:-0} -WAITFORIT_QUIET=${WAITFORIT_QUIET:-0} - -# Check to see if timeout is from busybox? -WAITFORIT_TIMEOUT_PATH=$(type -p timeout) -WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH) - -WAITFORIT_BUSYTIMEFLAG="" -if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then - WAITFORIT_ISBUSY=1 - # Check if busybox timeout uses -t flag - # (recent Alpine versions don't support -t anymore) - if timeout &>/dev/stdout | grep -q -e '-t '; then - WAITFORIT_BUSYTIMEFLAG="-t" - fi -else - WAITFORIT_ISBUSY=0 -fi - -if [[ $WAITFORIT_CHILD -gt 0 ]]; then - wait_for - WAITFORIT_RESULT=$? - exit $WAITFORIT_RESULT -else - if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then - wait_for_wrapper - WAITFORIT_RESULT=$? - else - wait_for - WAITFORIT_RESULT=$? - fi -fi - -if [[ $WAITFORIT_CLI != "" ]]; then - if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then - echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess" - exit $WAITFORIT_RESULT - fi - exec "${WAITFORIT_CLI[@]}" -else - exit $WAITFORIT_RESULT -fi \ No newline at end of file diff --git a/packages/cli/lang/en.json b/packages/cli/lang/en.json index ac7a3beaae..e416051cf1 100644 --- a/packages/cli/lang/en.json +++ b/packages/cli/lang/en.json @@ -176,13 +176,14 @@ "commands_run_error_envsExportNotArray": "Exported envs must be an array", "commands_run_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri' and optional properties 'common', 'query', and 'mutation'", "commands_run_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid wrap:// URI string", - "commands_run_error_envsItemModuleNotObject": "Env property 'module' at index {index} must be an object", + "commands_run_error_envsItemModuleNotObject": "Env property 'env' at index {index} must be an object", "commands_run_description": "Runs workflow script", "commands_run_error_missingScript": "Required argument {script} is missing", "commands_run_error_noApi": "API needs to be initialized", "commands_run_error_readFail": "Failed to read query {query}", + "commands_run_error_unsupportedOutputFileExt": "Unsupported outputFile extention: ${outputFileExt}", "commands_run_error_noWorkflowScriptFound": "Workflow script not found at path: {path}", - "commands_run_error_noTestEnvFound": "w3 test-env not found, please run 'w3 test-env up'", + "commands_run_error_noTestEnvFound": "polywrap test-env not found, please run 'polywrap infra up --modules=eth-ens-ipfs'", "commands_testEnv_description": "Manage a test environment for Polywrap", "commands_testEnv_error_never": "This should never happen...", "commands_testEnv_error_noCommand": "No command given", diff --git a/packages/cli/lang/es.json b/packages/cli/lang/es.json index c9e3b9866d..36d4ee781c 100644 --- a/packages/cli/lang/es.json +++ b/packages/cli/lang/es.json @@ -176,13 +176,14 @@ "commands_run_error_envsExportNotArray": "Exported envs must be an array", "commands_run_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri' and optional properties 'common', 'query', and 'mutation'", "commands_run_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid wrap:// URI string", - "commands_run_error_envsItemModuleNotObject": "Env property 'common' at index {index} must be an object", + "commands_run_error_envsItemModuleNotObject": "Env property 'env' at index {index} must be an object", "commands_run_description": "Runs workflow script", "commands_run_error_missingScript": "Required argument {script} is missing", "commands_run_error_noApi": "API needs to be initialized", "commands_run_error_readFail": "Failed to read query {query}", + "commands_run_error_unsupportedOutputFileExt": "Unsupported outputFile extention: ${outputFileExt}", "commands_run_error_noWorkflowScriptFound": "Workflow script not found at path: {path}", - "commands_run_error_noTestEnvFound": "w3 test-env not found, please run 'w3 test-env up'", + "commands_run_error_noTestEnvFound": "polywrap test-env not found, please run 'polywrap infra up --modules=eth-ens-ipfs'", "commands_testEnv_description": "Manage a test environment for Polywrap", "commands_testEnv_error_never": "This should never happen...", "commands_testEnv_error_noCommand": "No command given", diff --git a/packages/cli/src/commands/run.ts b/packages/cli/src/commands/run.ts index 1494c66522..8afa7afbb7 100644 --- a/packages/cli/src/commands/run.ts +++ b/packages/cli/src/commands/run.ts @@ -123,7 +123,7 @@ const _run = async (workflowPath: string, options: WorkflowCommandOptions) => { fs.writeFileSync(outputFile, JSON.stringify(workflowOutput, null, 2)); break; default: - throw new Error(`Unsupported outputFile extention: ${outputFileExt}`); + throw new Error(intlMsg.commands_run_error_unsupportedOutputFileExt({ outputFileExt })); } } }; diff --git a/packages/templates/api/assemblyscript/workflows/config.ts b/packages/templates/api/assemblyscript/workflows/config.ts index 9e0ec05fbd..3d5497795c 100644 --- a/packages/templates/api/assemblyscript/workflows/config.ts +++ b/packages/templates/api/assemblyscript/workflows/config.ts @@ -35,7 +35,7 @@ function getPlugins( }, { uri: "wrap://ens/ens.polywrap.eth", - plugin: ensPlugin({ query: { addresses: { testnet: ensAddress } } }), + plugin: ensPlugin({ addresses: { testnet: ensAddress } }), }, { uri: "wrap://ens/ethereum.polywrap.eth", diff --git a/packages/templates/api/assemblyscript/workflows/e2e.yaml b/packages/templates/api/assemblyscript/workflows/e2e.yaml index 45c360716b..8d66b4ab90 100644 --- a/packages/templates/api/assemblyscript/workflows/e2e.yaml +++ b/packages/templates/api/assemblyscript/workflows/e2e.yaml @@ -3,7 +3,6 @@ jobs: cases: steps: - uri: fs/build - module: mutation method: deployContract input: connection: null @@ -11,14 +10,12 @@ jobs: case1: steps: - uri: fs/build - module: mutation method: setData input: address: "$cases.0.data" value: 100 connection: null - uri: fs/build - module: query method: getData input: address: "$cases.0.data" diff --git a/packages/test-cases/cases/cli/wasm/run/workflows/config.ts b/packages/test-cases/cases/cli/wasm/run/workflows/config.ts index 18ed63f4ac..0869b4de1a 100644 --- a/packages/test-cases/cases/cli/wasm/run/workflows/config.ts +++ b/packages/test-cases/cases/cli/wasm/run/workflows/config.ts @@ -41,7 +41,7 @@ function getPlugins( }, { uri: "wrap://ens/ens.polywrap.eth", - plugin: ensPlugin({ query: { addresses: { testnet: ensAddress } } }), + plugin: ensPlugin({ addresses: { testnet: ensAddress } }), }, { uri: "wrap://ens/ethereum.polywrap.eth", diff --git a/packages/test-cases/cases/cli/wasm/run/workflows/e2e.json b/packages/test-cases/cases/cli/wasm/run/workflows/e2e.json index ca60531066..7193a1c6ce 100644 --- a/packages/test-cases/cases/cli/wasm/run/workflows/e2e.json +++ b/packages/test-cases/cases/cli/wasm/run/workflows/e2e.json @@ -5,7 +5,6 @@ "steps": [ { "uri": "fs/build", - "module": "mutation", "method": "deployContract", "input": { "connection": null } } @@ -15,7 +14,6 @@ "steps": [ { "uri": "fs/build", - "module": "mutation", "method": "setData", "input": { "options": { @@ -27,7 +25,6 @@ }, { "uri": "fs/build", - "module": "query", "method": "getData", "input": { "address": "$cases.0.data", "connection": null } } diff --git a/packages/test-cases/cases/cli/wasm/run/workflows/e2e.yaml b/packages/test-cases/cases/cli/wasm/run/workflows/e2e.yaml index b0b0148046..450829495e 100644 --- a/packages/test-cases/cases/cli/wasm/run/workflows/e2e.yaml +++ b/packages/test-cases/cases/cli/wasm/run/workflows/e2e.yaml @@ -3,7 +3,6 @@ jobs: cases: steps: - uri: fs/build - module: mutation method: deployContract input: connection: null @@ -11,7 +10,6 @@ jobs: case1: steps: - uri: fs/build - module: mutation method: setData input: options: @@ -19,7 +17,6 @@ jobs: value: 100 connection: null - uri: fs/build - module: query method: getData input: address: "$cases.0.data" From ddcd98e2753f0f1e9ea0749f5be6bf000a5709f9 Mon Sep 17 00:00:00 2001 From: Niraj Kamdar Date: Mon, 20 Jun 2022 18:47:52 +0400 Subject: [PATCH 23/38] fix: tests --- packages/cli/src/commands/run.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/run.ts b/packages/cli/src/commands/run.ts index 8afa7afbb7..66ba2f72a4 100644 --- a/packages/cli/src/commands/run.ts +++ b/packages/cli/src/commands/run.ts @@ -123,7 +123,9 @@ const _run = async (workflowPath: string, options: WorkflowCommandOptions) => { fs.writeFileSync(outputFile, JSON.stringify(workflowOutput, null, 2)); break; default: - throw new Error(intlMsg.commands_run_error_unsupportedOutputFileExt({ outputFileExt })); + throw new Error( + intlMsg.commands_run_error_unsupportedOutputFileExt({ outputFileExt }) + ); } } }; From 39f813616dda32b70c79686ff3bf4cdda02456fb Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 21 Jun 2022 20:50:07 +0200 Subject: [PATCH 24/38] chore: undo AS automatic json serialization --- .../wasm/assemblyscript/Dockerfile.mustache | 3 +- .../js/client/src/__tests__/e2e/test-cases.ts | 76 ++++--- .../imported/object-type/index-ts.mustache | 7 +- .../wasm-as/templates/json_methods.mustache | 7 - .../templates/object-type/index-ts.mustache | 7 +- .../output/wasm-as/AnotherType/index.ts | 13 +- .../sanity/output/wasm-as/CustomType/index.ts | 13 +- .../bind/sanity/output/wasm-as/Env/index.ts | 13 +- .../TestImport_AnotherObject/index.ts | 13 +- .../imported/TestImport_Object/index.ts | 13 +- .../wrappers/wasm-as/json-type/schema.graphql | 27 ++- .../wrappers/wasm-as/json-type/src/index.ts | 36 +++- .../wrappers/wasm-rs/json-type/schema.graphql | 27 ++- packages/wasm/as/assembly/json/index.ts | 6 +- packages/wasm/as/package.json | 3 +- yarn.lock | 195 +++++++----------- 16 files changed, 213 insertions(+), 246 deletions(-) delete mode 100644 packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/json_methods.mustache diff --git a/packages/cli/src/lib/defaults/build-images/wasm/assemblyscript/Dockerfile.mustache b/packages/cli/src/lib/defaults/build-images/wasm/assemblyscript/Dockerfile.mustache index e7519b153c..e233c527ec 100644 --- a/packages/cli/src/lib/defaults/build-images/wasm/assemblyscript/Dockerfile.mustache +++ b/packages/cli/src/lib/defaults/build-images/wasm/assemblyscript/Dockerfile.mustache @@ -39,6 +39,5 @@ RUN ./node_modules/.bin/asc {{dir}}/wrap/entry.ts \ --use abort={{dir}}/wrap/entry/wrapAbort \ --optimize --importMemory \ --runtime stub \ - --runPasses asyncify \ - --transform @serial-as/transform + --runPasses asyncify {{/polywrap_module}} diff --git a/packages/js/client/src/__tests__/e2e/test-cases.ts b/packages/js/client/src/__tests__/e2e/test-cases.ts index 52d8c0de63..39493c523a 100644 --- a/packages/js/client/src/__tests__/e2e/test-cases.ts +++ b/packages/js/client/src/__tests__/e2e/test-cases.ts @@ -632,40 +632,68 @@ export const runJsonTypeTest = async ( client: PolywrapClient, uri: string ) => { - const fromJson = await client.invoke<{ x: number; y: number }>({ + type Json = string; + const value = JSON.stringify({ foo: "bar", bar: "bar" }) + const parseResponse = await client.invoke<{ parse: Json }>({ uri, - method: "fromJson", + method: "parse", input: { - json: JSON.stringify({ x: 1, y: 2 }), - }, - }); + value + } + }) - expect(fromJson.error).toBeFalsy(); - expect(fromJson.data).toBeTruthy(); - expect(fromJson.data).toMatchObject({ - x: 1, - y: 2, - }); + expect(parseResponse.data).toEqual(value); + + const values = [ + JSON.stringify({ bar: "foo" }), + JSON.stringify({ baz: "fuz" }), + ]; - const toJson = await client.invoke<{ str: string }>({ + const stringifyResponse = await client.invoke<{ stringify: Json}>({ uri, - method: "toJson", + method: "stringify", input: { - pair: { - x: 1, - y: 2, - }, + values + } + }) + + expect(stringifyResponse.data).toEqual(values.join("")); + + const object = { + jsonA: JSON.stringify({ foo: "bar" }), + jsonB: JSON.stringify({ fuz: "baz" }), + }; + + const stringifyObjectResponse = await client.invoke<{ + stringifyObject: string; + }>({ + uri, + method: "stringifyObject", + input: { + object, }, }); - expect(toJson.error).toBeFalsy(); - expect(toJson.data).toBeTruthy(); - expect(toJson.data).toBe( - JSON.stringify({ - x: 1, - y: 2, - }) + expect(stringifyObjectResponse.data).toEqual( + object.jsonA + object.jsonB ); + + const json = { + valueA: 5, + valueB: "foo", + valueC: true + } + + const methodJSONResponse = await client.invoke<{ + methodJSON: Json; + }>({ + uri, + method: "methodJSON", + input: json + }); + + const methodJSONResult = JSON.stringify(json); + expect(methodJSONResponse.data).toEqual(methodJSONResult); }; export const runLargeTypesTest = async ( diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/imported/object-type/index-ts.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/imported/object-type/index-ts.mustache index ab841d2923..67b0c6616d 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/imported/object-type/index-ts.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/imported/object-type/index-ts.mustache @@ -4,9 +4,7 @@ import { Nullable, BigInt, BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, + JSON } from "@polywrap/wasm-as"; import { serialize{{type}}, @@ -16,7 +14,6 @@ import { } from "./serialization"; import * as Types from "../.."; -@serializable export class {{type}} { public static uri: string = "{{uri}}"; @@ -40,6 +37,4 @@ export class {{type}} { static read(reader: Read): {{type}} { return read{{type}}(reader); } - - {{> json_methods}} } diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/json_methods.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/json_methods.mustache deleted file mode 100644 index baa2597301..0000000000 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/json_methods.mustache +++ /dev/null @@ -1,7 +0,0 @@ -static toJson(type: {{type}}): JSON.Value { - return JSONSerializer.encode(type); -} - -static fromJson(json: JSON.Value): {{type}} { - return (new JSONDeserializer(json)).decode<{{type}}>(); -} diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/object-type/index-ts.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/object-type/index-ts.mustache index 9bdd689ad6..027abfc84a 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/object-type/index-ts.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/object-type/index-ts.mustache @@ -4,9 +4,7 @@ import { Nullable, BigInt, BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, + JSON } from "@polywrap/wasm-as"; import { serialize{{type}}, @@ -16,7 +14,6 @@ import { } from "./serialization"; import * as Types from ".."; -@serializable export class {{type}} { {{#properties}} {{#handleKeywords}}{{name}}{{/handleKeywords}}: {{#toWasm}}{{toGraphQLType}}{{/toWasm}}; @@ -37,6 +34,4 @@ export class {{type}} { static read(reader: Read): {{type}} { return read{{type}}(reader); } - - {{> json_methods}} } diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/index.ts index cd97ce73c5..079edb851d 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/index.ts @@ -4,9 +4,7 @@ import { Nullable, BigInt, BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, + JSON } from "@polywrap/wasm-as"; import { serializeAnotherType, @@ -16,7 +14,6 @@ import { } from "./serialization"; import * as Types from ".."; -@serializable export class AnotherType { prop: string | null; circular: Types.CustomType | null; @@ -37,12 +34,4 @@ export class AnotherType { static read(reader: Read): AnotherType { return readAnotherType(reader); } - - static toJson(type: AnotherType): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): AnotherType { - return (new JSONDeserializer(json)).decode(); - } } diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/index.ts index 0edc7a7894..106ba4ec4c 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/index.ts @@ -4,9 +4,7 @@ import { Nullable, BigInt, BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, + JSON } from "@polywrap/wasm-as"; import { serializeCustomType, @@ -16,7 +14,6 @@ import { } from "./serialization"; import * as Types from ".."; -@serializable export class CustomType { str: string; optStr: string | null; @@ -71,12 +68,4 @@ export class CustomType { static read(reader: Read): CustomType { return readCustomType(reader); } - - static toJson(type: CustomType): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): CustomType { - return (new JSONDeserializer(json)).decode(); - } } diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/index.ts index 09dee2ac73..b1d03b3c41 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/index.ts @@ -4,9 +4,7 @@ import { Nullable, BigInt, BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, + JSON } from "@polywrap/wasm-as"; import { serializeEnv, @@ -16,7 +14,6 @@ import { } from "./serialization"; import * as Types from ".."; -@serializable export class Env { prop: string; optProp: string | null; @@ -37,12 +34,4 @@ export class Env { static read(reader: Read): Env { return readEnv(reader); } - - static toJson(type: Env): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): Env { - return (new JSONDeserializer(json)).decode(); - } } diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/index.ts index 6a52f417bb..71b2e624e2 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/index.ts @@ -4,9 +4,7 @@ import { Nullable, BigInt, BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, + JSON } from "@polywrap/wasm-as"; import { serializeTestImport_AnotherObject, @@ -16,7 +14,6 @@ import { } from "./serialization"; import * as Types from "../.."; -@serializable export class TestImport_AnotherObject { public static uri: string = "testimport.uri.eth"; @@ -38,12 +35,4 @@ export class TestImport_AnotherObject { static read(reader: Read): TestImport_AnotherObject { return readTestImport_AnotherObject(reader); } - - static toJson(type: TestImport_AnotherObject): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): TestImport_AnotherObject { - return (new JSONDeserializer(json)).decode(); - } } diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/index.ts index fc03152ed8..2994b902f7 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/index.ts @@ -4,9 +4,7 @@ import { Nullable, BigInt, BigNumber, - JSON, - JSONSerializer, - JSONDeserializer, + JSON } from "@polywrap/wasm-as"; import { serializeTestImport_Object, @@ -16,7 +14,6 @@ import { } from "./serialization"; import * as Types from "../.."; -@serializable export class TestImport_Object { public static uri: string = "testimport.uri.eth"; @@ -45,12 +42,4 @@ export class TestImport_Object { static read(reader: Read): TestImport_Object { return readTestImport_Object(reader); } - - static toJson(type: TestImport_Object): JSON.Value { - return JSONSerializer.encode(type); - } - - static fromJson(json: JSON.Value): TestImport_Object { - return (new JSONDeserializer(json)).decode(); - } } diff --git a/packages/test-cases/cases/wrappers/wasm-as/json-type/schema.graphql b/packages/test-cases/cases/wrappers/wasm-as/json-type/schema.graphql index ccae1af02b..cb60b87271 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/json-type/schema.graphql +++ b/packages/test-cases/cases/wrappers/wasm-as/json-type/schema.graphql @@ -1,9 +1,24 @@ type Module { - fromJson(json: JSON!): Pair! - toJson(pair: Pair!): JSON! -} + parse( + value: String! + ): JSON! + + stringify( + values: [JSON!]! + ): String! -type Pair { - x: Int! - y: Int! + stringifyObject( + object: Object! + ): String! + + methodJSON( + valueA: Int! + valueB: String! + valueC: Boolean! + ): JSON! } + +type Object { + jsonA: JSON! + jsonB: JSON! +} \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/json-type/src/index.ts b/packages/test-cases/cases/wrappers/wasm-as/json-type/src/index.ts index 1f9a6be8db..553f2b5b52 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/json-type/src/index.ts +++ b/packages/test-cases/cases/wrappers/wasm-as/json-type/src/index.ts @@ -1,14 +1,36 @@ import { - Input_fromJson, - Input_toJson, - Pair + Input_parse, + Input_stringify, + Input_stringifyObject, + Input_methodJSON } from "./wrap"; import { JSON } from "@polywrap/wasm-as"; -export function fromJson(input: Input_fromJson): Pair { - return Pair.fromJson(input.json); +export function parse(input: Input_parse): JSON.Value { + return JSON.parse(input.value); } -export function toJson(input: Input_toJson): JSON.Value { - return Pair.toJson(input.pair); +export function stringify(input: Input_stringify): string { + let str = ""; + for (let i = 0; i < input.values.length; ++i) { + const value = input.values[i]; + str += value.stringify(); + } + return str; } + +export function stringifyObject(input: Input_stringifyObject): string { + let str = ""; + str += input.object.jsonA.stringify(); + str += input.object.jsonB.stringify(); + return str; +} + +export function methodJSON(input: Input_methodJSON): JSON.Value { + const result = JSON.Value.Object(); + result.set("valueA", JSON.from(input.valueA)); + result.set("valueB", JSON.from(input.valueB)); + result.set("valueC", JSON.from(input.valueC)); + + return result; +} \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-rs/json-type/schema.graphql b/packages/test-cases/cases/wrappers/wasm-rs/json-type/schema.graphql index ccae1af02b..cb60b87271 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/json-type/schema.graphql +++ b/packages/test-cases/cases/wrappers/wasm-rs/json-type/schema.graphql @@ -1,9 +1,24 @@ type Module { - fromJson(json: JSON!): Pair! - toJson(pair: Pair!): JSON! -} + parse( + value: String! + ): JSON! + + stringify( + values: [JSON!]! + ): String! -type Pair { - x: Int! - y: Int! + stringifyObject( + object: Object! + ): String! + + methodJSON( + valueA: Int! + valueB: String! + valueC: Boolean! + ): JSON! } + +type Object { + jsonA: JSON! + jsonB: JSON! +} \ No newline at end of file diff --git a/packages/wasm/as/assembly/json/index.ts b/packages/wasm/as/assembly/json/index.ts index dd01d736aa..2925c6b247 100644 --- a/packages/wasm/as/assembly/json/index.ts +++ b/packages/wasm/as/assembly/json/index.ts @@ -1,5 +1 @@ -export { - ValueDeserializer as JSONDeserializer, - ValueSerializer as JSONSerializer, - JSON, -} from "@web3api/serial-as-json"; +export * from "@web3api/assemblyscript-json"; diff --git a/packages/wasm/as/package.json b/packages/wasm/as/package.json index cd88d632ac..b66b8ce24a 100644 --- a/packages/wasm/as/package.json +++ b/packages/wasm/as/package.json @@ -21,8 +21,7 @@ "test:ci": "asp --summary" }, "dependencies": { - "@serial-as/transform": "1.0.2", - "@web3api/serial-as-json": "1.0.4", + "@web3api/assemblyscript-json": "1.2.0", "as-bigint": "0.5.3", "as-bignumber": "0.2.0", "as-container": "0.6.1" diff --git a/yarn.lock b/yarn.lock index 57019aadd2..c4327bce52 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1384,9 +1384,9 @@ strip-json-comments "^3.1.1" "@ethersproject/abi@^5.0.0", "@ethersproject/abi@^5.6.3": - version "5.6.3" - resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.6.3.tgz#2d643544abadf6e6b63150508af43475985c23db" - integrity sha512-CxKTdoZY4zDJLWXG6HzNH6znWK0M79WzzxHegDoecE3+K32pzfHOzuXg2/oGSTecZynFgpkjYXNPOqXVJlqClw== + version "5.6.4" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.6.4.tgz#f6e01b6ed391a505932698ecc0d9e7a99ee60362" + integrity sha512-TTeZUlCeIHG6527/2goZA6gW5F8Emoc7MrZDC7hhP84aRGvW3TEdTnZR08Ls88YXM1m2SuK42Osw/jSi3uO8gg== dependencies: "@ethersproject/address" "^5.6.1" "@ethersproject/bignumber" "^5.6.2" @@ -1571,9 +1571,9 @@ integrity sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg== "@ethersproject/networks@^5.0.0", "@ethersproject/networks@^5.0.3", "@ethersproject/networks@^5.6.3": - version "5.6.3" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.6.3.tgz#3ee3ab08f315b433b50c99702eb32e0cf31f899f" - integrity sha512-QZxRH7cA5Ut9TbXwZFiCyuPchdWi87ZtVNHWZd0R6YFgYtes2jQ3+bsslJ0WdyDe0i6QumqtoYqvY3rrQFRZOQ== + version "5.6.4" + resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.6.4.tgz#51296d8fec59e9627554f5a8a9c7791248c8dc07" + integrity sha512-KShHeHPahHI2UlWdtDMn2lJETcbtaJge4k7XSjDR9h79QTd6yQJmv6Cp2ZA4JdqWnhszAOLSuJEd9C0PRw7hSQ== dependencies: "@ethersproject/logger" "^5.6.0" @@ -3081,10 +3081,10 @@ "@octokit/types" "^6.0.3" universal-user-agent "^6.0.0" -"@octokit/openapi-types@^12.1.0": - version "12.1.0" - resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-12.1.0.tgz#a68b60e969f26dee0eb7d127c65a84967f2d3a6e" - integrity sha512-kQzJh3ZUv3lDpi6M+uekMRHULvf9DlWoI1XgKN6nPeGDzkSgtkhVq1MMz3bFKQ6H6GbdC3ZqG/a6VzKhIx0VeA== +"@octokit/openapi-types@^12.4.0": + version "12.4.0" + resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-12.4.0.tgz#fd8bf5db72bd566c5ba2cb76754512a9ebe66e71" + integrity sha512-Npcb7Pv30b33U04jvcD7l75yLU0mxhuX2Xqrn51YyZ5WTkF04bpbxLaZ6GcaTqu03WZQHoO/Gbfp95NGRueDUA== "@octokit/plugin-enterprise-rest@^6.0.1": version "6.0.1" @@ -3092,11 +3092,11 @@ integrity sha512-93uGjlhUD+iNg1iWhUENAtJata6w5nE+V4urXOAlIXdco6xNZtUSfYY8dzp3Udy74aqO/B5UZL80x/YMa5PKRw== "@octokit/plugin-paginate-rest@^2.16.8": - version "2.18.0" - resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.18.0.tgz#e412977782690a4134b0a4aa2f536cca7a2ca125" - integrity sha512-n5/AzIoy5Wzp85gqzSbR+dWQDHlyHZrGijnDfLh452547Ynu0hCvszH7EfRE0eqM5ZjfkplO0k+q+P8AAIIJEA== + version "2.19.0" + resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.19.0.tgz#b52eae6ecacfa1f5583dc2cc0985cfbed3ca78b0" + integrity sha512-hQ4Qysg2hNmEMuZeJkvyzM4eSZiTifOKqYAMsW8FnxFKowhuwWICSgBQ9Gn9GpUmgKB7qaf1hFvMjYaTAg5jQA== dependencies: - "@octokit/types" "^6.35.0" + "@octokit/types" "^6.36.0" "@octokit/plugin-request-log@^1.0.4": version "1.0.4" @@ -3104,11 +3104,11 @@ integrity sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA== "@octokit/plugin-rest-endpoint-methods@^5.12.0": - version "5.14.0" - resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.14.0.tgz#758e01ac40998e607feaea7f80220c69990814ae" - integrity sha512-MRnMs4Dcm1OSaz/g/RLr4YY9otgysS7vN5SUkHGd7t+R8323cHsHFoEWHYPSmgUC0BieHRhvnCRWb4i3Pl+Lgg== + version "5.15.0" + resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.15.0.tgz#6c8251b55c33315a6e53e5b55654f72023ed5049" + integrity sha512-Gsw9+Xm56jVhfbJoy4pt6eOOyf8/3K6CAnx1Sl7U2GhZWcg8MR6YgXWnpfdF69S2ViMXLA7nfvTDAsZpFlkLRw== dependencies: - "@octokit/types" "^6.35.0" + "@octokit/types" "^6.36.0" deprecation "^2.3.1" "@octokit/request-error@^2.0.5", "@octokit/request-error@^2.1.0": @@ -3142,12 +3142,12 @@ "@octokit/plugin-request-log" "^1.0.4" "@octokit/plugin-rest-endpoint-methods" "^5.12.0" -"@octokit/types@^6.0.3", "@octokit/types@^6.16.1", "@octokit/types@^6.35.0": - version "6.35.0" - resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.35.0.tgz#11cd9a679c32b4a6c36459ae2ec3ac4de0104f71" - integrity sha512-DhLfdUuv3H37u6jBDfkwamypx3HflHg29b26nbA6iVFYkAlZ5cMEtu/9pQoihGnQE5M7jJFnNo25Rr1UwQNF8Q== +"@octokit/types@^6.0.3", "@octokit/types@^6.16.1", "@octokit/types@^6.36.0": + version "6.37.0" + resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.37.0.tgz#32eb78edb34cf5cea4ba5753ab8db75b776d617a" + integrity sha512-BXWQhFKRkjX4dVW5L2oYa0hzWOAqsEsujXsQLSdepPoDZfYdubrD1KDGpyNldGXtR8QM/WezDcxcIN1UKJMGPA== dependencies: - "@octokit/openapi-types" "^12.1.0" + "@octokit/openapi-types" "^12.4.0" "@opentelemetry/api-metrics@0.20.0": version "0.20.0" @@ -3284,21 +3284,6 @@ "@opentelemetry/semantic-conventions" "0.20.0" "@opentelemetry/tracing" "0.20.0" -"@serial-as/core@1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@serial-as/core/-/core-1.0.2.tgz#a3b21d6962fed7aaae978d63bc0551be65b36ea6" - integrity sha512-aJFMzEn5eztHI5ZcxCGYiRXuj8xVQt+JGTzCVHq/NMBHubAi4MC48/e3VVjqGoHo+FdPlnGropx08YPrc3ENCw== - dependencies: - "@serial-as/transform" "1.0.2" - as-bignum "^0.2.17" - -"@serial-as/transform@1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@serial-as/transform/-/transform-1.0.2.tgz#95ed7aa2879f13825ea4b404718ee1eca9ad71c7" - integrity sha512-1Uti3bxGYrkN1yhV0aVuAQ46dsEvWXUDVQ+2btC5nFo0N2UJ8860K3HVc6y3Xm2pEDMW/6IrmfZoapNV1E3jMw== - dependencies: - visitor-as "^0.7.0-1" - "@sinonjs/commons@^1.7.0": version "1.8.3" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d" @@ -3472,14 +3457,14 @@ integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== "@tsconfig/node12@^1.0.7": - version "1.0.10" - resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.10.tgz#10fecee4a3be17357ce99b370bd81874044d8dbd" - integrity sha512-N+srakvPaYMGkwjNDx3ASx65Zl3QG8dJgVtIB+YMOkucU+zctlv/hdP5250VKdDHSDoW9PFZoCqbqNcAPjCjXA== + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" + integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== "@tsconfig/node14@^1.0.0": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.2.tgz#b09c08de2eb319ca2acab17a1b8028af110b24b3" - integrity sha512-YwrUA5ysDXHFYfL0Xed9x3sNS4P+aKlCOnnbqUa2E5HdQshHFleCJVrj1PlGTb4GgFUCDyte1v3JWLy2sz8Oqg== + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" + integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== "@tsconfig/node16@^1.0.2": version "1.0.3" @@ -3670,9 +3655,9 @@ integrity sha512-wH6Tu9mbiOt0n5EvdoWy0VGQaJMHfLIxY/6wS0xLC7CV1taM6gESEzcYy0ZlWvxxiiljYvfDIvz4hHbUUDRlhw== "@types/node@*": - version "17.0.44" - resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.44.tgz#16dd0bb5338f016d8ca10631789f0d0612fe5d5b" - integrity sha512-gWYiOlu6Y4oyLYBvsJAPlwHbC8H4tX+tLsHy6Ee976wedwwZKrG2hFl3Y/HiH6bIyLTbDWQexQF/ohwKkOpUCg== + version "18.0.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.0.0.tgz#67c7b724e1bcdd7a8821ce0d5ee184d3b4dd525a" + integrity sha512-cHlGmko4gWLVI27cGJntjs/Sj8th9aYwplmZFwmmgYQQvL5NUsgVJG7OddLvNfLqYS31KFN0s3qlaD9qCaxACA== "@types/node@12.12.26": version "12.12.26" @@ -3941,15 +3926,6 @@ resolved "https://registry.yarnpkg.com/@web3api/assemblyscript-json/-/assemblyscript-json-1.2.0.tgz#f01f11f12a66cd1a319d43f12e476307d1ad3da8" integrity sha512-x+wchJpH1giJzXj3dYs8vh2SKMXepeqVXiaFV/YCtXg4X/KaUnxi0kp5JugbEAyEJurEScH1YuV6IvGhGui/fw== -"@web3api/serial-as-json@1.0.4": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@web3api/serial-as-json/-/serial-as-json-1.0.4.tgz#87724866b823182591ab6831c7c24b87f713a520" - integrity sha512-ip5VsRFIXIlqiPxAivNnS/UoyuMZiflKz2ljgjJABmeFhwbuuoMxUO/efHc85mqZ2AGbG1n4K8q+mcH8hqchcQ== - dependencies: - "@serial-as/core" "1.0.2" - "@web3api/assemblyscript-json" "1.2.0" - as-base64 "^0.2.0" - "@webassemblyjs/ast@1.8.5": version "1.8.5" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.8.5.tgz#51b1c5fe6576a34953bf4b253df9f0d490d9e359" @@ -4612,21 +4588,11 @@ arrify@^2.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== -as-base64@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/as-base64/-/as-base64-0.2.0.tgz#b4bed937c93bfb6524b932b517e1b8571a0dd518" - integrity sha512-j6JxprAVN4SXUcZiSChuMBf0JJOCdh5OfrHAepluxmFWuDZZm+YjmfNSk8djUHRPEB+Ui5HGvrz46GLvTJf3ig== - as-bigint@0.5.3, as-bigint@^0.5.1: version "0.5.3" resolved "https://registry.yarnpkg.com/as-bigint/-/as-bigint-0.5.3.tgz#a0647d0b7ce835077aca33115e71eb26a83df8be" integrity sha512-tg9iTO/vPeovOM5CSk1WxYcsfBd/cd3twhBW5PrpcGUfiSEXlPB69eOxFKvSbZnpuDxBAyQ4YBgEkfnYL89Czw== -as-bignum@^0.2.17: - version "0.2.18" - resolved "https://registry.yarnpkg.com/as-bignum/-/as-bignum-0.2.18.tgz#61ed4dd07d4a62107bde227fdb4370190217bf0b" - integrity sha512-5LODrOr7wvS643oh7PHfyRtbBO9vCcU69vNNvrqh5yovrApM9nRHDeT5XcqnaSI8TqK9ZhN12qhZnq4rdIGcwQ== - as-bignumber@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/as-bignumber/-/as-bignumber-0.2.0.tgz#13feb2e5054c8a2d557618de2e507af39cfb7532" @@ -5362,15 +5328,14 @@ browserslist@4.10.0: pkg-up "^3.1.0" browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.20.2, browserslist@^4.20.4, browserslist@^4.6.2, browserslist@^4.6.4, browserslist@^4.9.1: - version "4.20.4" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.20.4.tgz#98096c9042af689ee1e0271333dbc564b8ce4477" - integrity sha512-ok1d+1WpnU24XYN7oC3QWgTyMhY/avPJ/r9T00xxvUOIparA/gc+UPUMaod3i+G6s+nI2nUb9xZ5k794uIwShw== + version "4.21.0" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.0.tgz#7ab19572361a140ecd1e023e2c1ed95edda0cefe" + integrity sha512-UQxE0DIhRB5z/zDz9iA03BOfxaN2+GQdBYH/2WrSIWEUrnpzTPJbhqt+umq6r3acaPRTW1FNTkrcp0PXgtFkvA== dependencies: - caniuse-lite "^1.0.30001349" - electron-to-chromium "^1.4.147" - escalade "^3.1.1" + caniuse-lite "^1.0.30001358" + electron-to-chromium "^1.4.164" node-releases "^2.0.5" - picocolors "^1.0.0" + update-browserslist-db "^1.0.0" bs-logger@0.x: version "0.2.6" @@ -5639,10 +5604,10 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" 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.30001349: - version "1.0.30001354" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001354.tgz#95c5efdb64148bb4870771749b9a619304755ce5" - integrity sha512-mImKeCkyGDAHNywYFA4bqnLAzTUvVkqPvhY4DV47X+Gl2c5Z8c3KNETnXp14GQt11LvxE8AwjzGxJ+rsikiOzg== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001035, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001358: + version "1.0.30001358" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001358.tgz#473d35dabf5e448b463095cab7924e96ccfb8c00" + integrity sha512-hvp8PSRymk85R20bsDra7ZTCpSVGN/PAz9pSAjPSjKC+rNmnUk5vCRgJwiTT/O4feQ/yu/drvZYpKxxhbFuChw== capture-exit@^2.0.0: version "2.0.0" @@ -6370,17 +6335,17 @@ copyfiles@2.4.1: yargs "^16.1.0" core-js-compat@^3.21.0, core-js-compat@^3.22.1, core-js-compat@^3.6.2: - version "3.23.1" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.23.1.tgz#23d44d9f209086e60dabf9130cea7719af6e199b" - integrity sha512-KeYrEc8t6FJsKYB2qnDwRHWaC0cJNaqlHfCpMe5q3j/W1nje3moib/txNklddLPCtGb+etcBIyJ8zuMa/LN5/A== + version "3.23.2" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.23.2.tgz#5cbf8a9c8812d665392845b85ae91b5bcc7b615c" + integrity sha512-lrgZvxFwbQp9v7E8mX0rJ+JX7Bvh4eGULZXA1IAyjlsnWvCdw6TF8Tg6xtaSUSJMrSrMaLdpmk+V54LM1dvfOA== dependencies: browserslist "^4.20.4" semver "7.0.0" core-js-pure@^3.20.2: - version "3.23.1" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.23.1.tgz#0b27e4c3ad46178b84e790dbbb81987218ab82ad" - integrity sha512-3qNgf6TqI3U1uhuSYRzJZGfFd4T+YlbyVPl+jgRiKjdZopvG4keZQwWZDAWpu1UH9nCgTpUzIV3GFawC7cJsqg== + version "3.23.2" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.23.2.tgz#efe5e486469c5ed2d088d76e973eb12e74a930e7" + integrity sha512-t6u7H4Ff/yZNk+zqTr74UjCcZ3k8ApBryeLLV4rYQd9aF3gqmjjGjjR44ENfeBMH8VVvSynIjAJ0mUuFhzQtrA== core-js@^2.4.0: version "2.6.12" @@ -6388,9 +6353,9 @@ core-js@^2.4.0: integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== core-js@^3.5.0: - version "3.23.1" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.23.1.tgz#9f9a9255115f62c512db56d567f636da32ca0b78" - integrity sha512-wfMYHWi1WQjpgZNC9kAlN4ut04TM9fUTdi7CqIoTVM7yaiOUQTklOzfb+oWH3r9edQcT3F887swuVmxrV+CC8w== + version "3.23.2" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.23.2.tgz#e07a60ca8b14dd129cabdc3d2551baf5a01c76f0" + integrity sha512-ELJOWxNrJfOH/WK4VJ3Qd+fOqZuOuDNDJz0xG6Bt4mGg2eO/UT9CljCrbqDGovjLKUrGajEEBcoTOc0w+yBYeQ== core-util-is@1.0.2: version "1.0.2" @@ -7319,10 +7284,10 @@ electron-fetch@^1.7.2: dependencies: encoding "^0.1.13" -electron-to-chromium@^1.3.378, electron-to-chromium@^1.4.147: - version "1.4.157" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.157.tgz#25799684ed6f2be52bee2b716f9de257b24f3ba7" - integrity sha512-gteFnXPKsDAdm1U5vVuyrLnKOaR/x/SY+HjUQoHypLUYWJt4RaWU3PaiTBEkRDJh8/Zd8KC/EFjV+uPaHsjKFA== +electron-to-chromium@^1.3.378, electron-to-chromium@^1.4.164: + version "1.4.164" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.164.tgz#3d0f5c83557d8ec8a7faa531e498f198c3bd974a" + integrity sha512-K7iy5y6XyP9Pzh3uaDti0KC4JUNT6T1tLG5RTOmesqq2YgAJpYYYJ32m+anvZYjCV35llPTEh87kvEV/uSsiyQ== elliptic@6.5.4, elliptic@^6.5.3: version "6.5.4" @@ -9952,7 +9917,7 @@ is-color-stop@^1.0.0: rgb-regex "^1.0.1" rgba-regex "^1.0.0" -is-core-module@^2.5.0, is-core-module@^2.8.1: +is-core-module@^2.5.0, is-core-module@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== @@ -12547,9 +12512,9 @@ minipass@^2.6.0, minipass@^2.9.0: yallist "^3.0.0" minipass@^3.0.0, minipass@^3.1.0, minipass@^3.1.1, minipass@^3.1.3: - version "3.1.6" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.6.tgz#3b8150aa688a711a1521af5e8779c1d3bb4f45ee" - integrity sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ== + version "3.3.3" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.3.3.tgz#fd1f0e6c06449c10dadda72618b59c00f3d6378d" + integrity sha512-N0BOsdFAlNRfmwMhjAsLVWOk7Ljmeb39iqFlsV1At+jqRhSUP9yeof8FyJu4imaJiSUp8vQebWD/guZwGQC8iA== dependencies: yallist "^4.0.0" @@ -14757,9 +14722,9 @@ prettier@2.2.1: integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== prettier@^2.2.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.0.tgz#a4fdae07e5596c51c9857ea676cd41a0163879d6" - integrity sha512-nwoX4GMFgxoPC6diHvSwmK/4yU8FFH3V8XWtLQrbj4IBsK2pkYhG4kf/ljF/haaZ/aii+wNJqISrCDPgxGWDVQ== + version "2.7.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" + integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== pretty-bytes@^5.1.0: version "5.6.0" @@ -15774,11 +15739,11 @@ resolve@1.15.0: path-parse "^1.0.6" resolve@^1.10.0, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.15.1, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.20.0, resolve@^1.3.2, resolve@^1.8.1: - version "1.22.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" - integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== + version "1.22.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" + integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== dependencies: - is-core-module "^2.8.1" + is-core-module "^2.9.0" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" @@ -17494,14 +17459,14 @@ typescript@4.0.7: integrity sha512-yi7M4y74SWvYbnazbn8/bmJmX4Zlej39ZOqwG/8dut/MYoSQ119GY9ZFbbGsD4PFZYWxqik/XsP3vk3+W5H3og== typescript@^4.0: - version "4.7.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.3.tgz#8364b502d5257b540f9de4c40be84c98e23a129d" - integrity sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA== + version "4.7.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" + integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== uglify-js@^3.1.4: - version "3.16.0" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.16.0.tgz#b778ba0831ca102c1d8ecbdec2d2bdfcc7353190" - integrity sha512-FEikl6bR30n0T3amyBh3LoiBdqHRy/f4H80+My34HOesOKyHfOsxAPAxOoqC0JUnC1amnO0IwkYC3sko51caSw== + version "3.16.1" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.16.1.tgz#0e7ec928b3d0b1e1d952bce634c384fd56377317" + integrity sha512-X5BGTIDH8U6IQ1TIRP62YC36k+ULAa1d59BxlWvPUJ1NkW5L3FwcGfEzuVvGmhJFBu0YJ5Ge25tmRISqCmLiRQ== uid-number@0.0.6: version "0.0.6" @@ -17660,6 +17625,14 @@ upath@^2.0.1: resolved "https://registry.yarnpkg.com/upath/-/upath-2.0.1.tgz#50c73dea68d6f6b990f51d279ce6081665d61a8b" integrity sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w== +update-browserslist-db@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.3.tgz#6c47cb996f34afb363e924748e2f6e4d983c6fc1" + integrity sha512-ufSazemeh9Gty0qiWtoRpJ9F5Q5W3xdIPm1UZQqYQv/q0Nyb9EMHUB2lu+O9x1re9WsorpMAUu4Y6Lxcs5n+XQ== + dependencies: + escalade "^3.1.1" + picocolors "^1.0.0" + uri-js@^4.2.2: version "4.4.1" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" @@ -17860,14 +17833,6 @@ visitor-as@^0.6.0: lodash.clonedeep "^4.5.0" ts-mixer "^5.4.1" -visitor-as@^0.7.0-1: - version "0.7.0-2" - resolved "https://registry.yarnpkg.com/visitor-as/-/visitor-as-0.7.0-2.tgz#28f1c51801a677f14c4487c78a85ad541cfe382d" - integrity sha512-JDviqVnGn8i5qafLYuZUGlNeyc/8STIBnmNiXizvHO29xxJDaHNHxbr4Gh+9ksIJvMh9TNQKBeSyT2tldNbpJw== - dependencies: - lodash.clonedeep "^4.5.0" - ts-mixer "^5.4.1" - vm-browserify@^1.0.1: version "1.1.2" resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" From c05cd3f1d895478bf7f8881f7a5be5585e97c459 Mon Sep 17 00:00:00 2001 From: Nestor Amesty Date: Tue, 21 Jun 2022 23:04:16 +0200 Subject: [PATCH 25/38] v0.0.1-prealpha.87 --- package.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index bcf270a2b2..3cd185b4d2 100644 --- a/package.json +++ b/package.json @@ -46,20 +46,21 @@ }, "devDependencies": { "@types/prettier": "2.6.0", - "lerna": "4.0.0", - "rimraf": "3.0.2", "@typescript-eslint/eslint-plugin": "4.11.1", "@typescript-eslint/parser": "4.11.1", "eslint": "7.16.0", "eslint-config-prettier": "7.1.0", "eslint-plugin-import": "2.22.1", + "eslint-plugin-json": "3.0.0", "eslint-plugin-prettier": "3.4.0", - "prettier": "2.2.1", "graphql": "15.5.0", - "eslint-plugin-json": "3.0.0" + "lerna": "4.0.0", + "prettier": "2.2.1", + "rimraf": "3.0.2" }, "resolutions": { "@types/react": "16.9.0", "@types/react-dom": "16.9.0" - } + }, + "version": "0.0.1-prealpha.87" } From 440a5353b8fe6defa62ec52a0a1474d860d8c90d Mon Sep 17 00:00:00 2001 From: cbrzn Date: Tue, 21 Jun 2022 23:18:54 +0200 Subject: [PATCH 26/38] rs cli fix almost achieved --- .../wrappers/wasm-rs/json-type/src/lib.rs | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/packages/test-cases/cases/wrappers/wasm-rs/json-type/src/lib.rs b/packages/test-cases/cases/wrappers/wasm-rs/json-type/src/lib.rs index 9c157f5361..d2b7c92437 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/json-type/src/lib.rs +++ b/packages/test-cases/cases/wrappers/wasm-rs/json-type/src/lib.rs @@ -3,10 +3,26 @@ pub use wrap::*; use polywrap_wasm_rs::JSON; use serde_json::*; -pub fn from_json(input: InputFromJson) -> Pair { - serde_json::from_value::(input.json).unwrap() +pub fn stringify(input: InputStringify) -> String { + let mut new_string = String::from(""); + for object in &input.values { + new_string.push_str(&object.to_string()); + } + new_string } -pub fn to_json(input: InputToJson) -> JSON::Value { - JSON::to_value(&input.pair).unwrap() +pub fn parse(input: InputParse) -> JSON::Value { JSON::to_value(&input.value).unwrap() } + +pub fn stringify_object(input: InputStringifyObject) -> String { + let mut new_string = String::from(&input.object.json_a.to_string()); + new_string.push_str(&input.object.json_b.to_string()); + new_string } + +pub fn method_j_s_o_n(input: InputMethodJSON) -> JSON::Value { + json!({ + "valueA": input.value_a, + "valueB": input.value_b, + "valueC": input.value_c + }) +} \ No newline at end of file From edb02260b03bb2d9e6841ff17b55933b857dd3eb Mon Sep 17 00:00:00 2001 From: cbrzn Date: Wed, 22 Jun 2022 00:04:27 +0200 Subject: [PATCH 27/38] chore: json type rust test fixed --- packages/test-cases/cases/wrappers/wasm-rs/json-type/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/test-cases/cases/wrappers/wasm-rs/json-type/src/lib.rs b/packages/test-cases/cases/wrappers/wasm-rs/json-type/src/lib.rs index d2b7c92437..771fd3f151 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/json-type/src/lib.rs +++ b/packages/test-cases/cases/wrappers/wasm-rs/json-type/src/lib.rs @@ -11,7 +11,7 @@ pub fn stringify(input: InputStringify) -> String { new_string } -pub fn parse(input: InputParse) -> JSON::Value { JSON::to_value(&input.value).unwrap() } +pub fn parse(input: InputParse) -> JSON::Value { JSON::from_str(&input.value).unwrap() } pub fn stringify_object(input: InputStringifyObject) -> String { let mut new_string = String::from(&input.object.json_a.to_string()); From 08122360fd10602e30ba3dd393e7ea92872052ce Mon Sep 17 00:00:00 2001 From: krisbitney Date: Wed, 22 Jun 2022 20:56:03 +0300 Subject: [PATCH 28/38] fixed npmCli path in test-env-js --- packages/js/test-env/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/js/test-env/src/index.ts b/packages/js/test-env/src/index.ts index ab6874e950..2b46e1bdcd 100644 --- a/packages/js/test-env/src/index.ts +++ b/packages/js/test-env/src/index.ts @@ -23,7 +23,7 @@ export const providers = { }; const monorepoCli = `${__dirname}/../../../cli/bin/polywrap`; -const npmCli = `${__dirname}/../../polywrap/bin/polywrap`; +const npmCli = `${__dirname}/../../../polywrap/bin/polywrap`; async function awaitResponse( url: string, From ac1f098d8acf49871e45ad26c9d99d599e2adc61 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Wed, 22 Jun 2022 13:06:29 -0700 Subject: [PATCH 29/38] fix usePolywrapInvoke test --- .../js/react/src/__tests__/usePolywrapInvoke.spec.tsx | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/packages/js/react/src/__tests__/usePolywrapInvoke.spec.tsx b/packages/js/react/src/__tests__/usePolywrapInvoke.spec.tsx index 4d47dbacd4..347c8659d5 100644 --- a/packages/js/react/src/__tests__/usePolywrapInvoke.spec.tsx +++ b/packages/js/react/src/__tests__/usePolywrapInvoke.spec.tsx @@ -82,7 +82,6 @@ describe("usePolywrapInvoke hook", () => { ) { const hook = () => usePolywrapInvoke({ uri: options.uri, - module: options.module, method: options.method, provider: options.provider }); @@ -101,7 +100,6 @@ describe("usePolywrapInvoke hook", () => { it("Should support passing env to client", async () => { const deployQuery: UsePolywrapInvokeProps = { uri: envUri, - module: "query", method: "getEnv", input: { arg: "Alice" @@ -130,7 +128,6 @@ describe("usePolywrapInvoke hook", () => { it("Should update storage data to five", async () => { const deployInvoke: UsePolywrapInvokeProps = { uri, - module: "mutation", method: "deployContract", input: { connection: { @@ -143,7 +140,6 @@ describe("usePolywrapInvoke hook", () => { const setStorageInvocation: UsePolywrapInvokeProps = { uri, - module: "mutation", method: "setData", input: { address: address, @@ -160,7 +156,6 @@ describe("usePolywrapInvoke hook", () => { const getStorageDataInvocation: UsePolywrapInvokeProps = { uri, - module: "query", method: "getData", input: { address: address, @@ -178,7 +173,6 @@ describe("usePolywrapInvoke hook", () => { const getStorageDataInvocation: UsePolywrapInvokeProps = { provider: "Non existent Polywrap Provider", uri, - module: "query", method: "getData", input: { address: "foo", @@ -199,7 +193,6 @@ describe("usePolywrapInvoke hook", () => { const getStorageDataInvocation: UsePolywrapInvokeProps = { provider: "other", uri, - module: "query", method: "getData", input: { address: "foo", @@ -217,7 +210,6 @@ describe("usePolywrapInvoke hook", () => { it("Should update storage data to three by setting value through variables passed to exec", async () => { const deployInvoke: UsePolywrapInvokeProps = { uri, - module: "mutation", method: "deployContract", input: { connection: { @@ -230,7 +222,6 @@ describe("usePolywrapInvoke hook", () => { const setStorageInvocation: UsePolywrapInvokeProps = { uri, - module: "mutation", method: "setData", input: { address: address, @@ -247,7 +238,6 @@ describe("usePolywrapInvoke hook", () => { const getStorageDataInvocation: UsePolywrapInvokeProps = { uri, - module: "query", method: "getData", input: { address: address, From dcc9edd8011720d7398ccc62932908722320b4d1 Mon Sep 17 00:00:00 2001 From: Anton Davydov Date: Wed, 22 Jun 2022 19:15:16 +0400 Subject: [PATCH 30/38] replace Nullable with Option --- .../assemblyscript/wasm-as/functions.ts | 7 +- .../templates/deserialize_enum.mustache | 10 +-- .../imported/module-type/index-ts.mustache | 2 +- .../module-type/serialization-ts.mustache | 2 +- .../imported/object-type/index-ts.mustache | 2 +- .../module-type/serialization-ts.mustache | 2 +- .../templates/object-type/index-ts.mustache | 2 +- .../templates/serialization_imports.mustache | 2 +- .../output/wasm-as/AnotherType/index.ts | 2 +- .../wasm-as/AnotherType/serialization.ts | 2 +- .../sanity/output/wasm-as/CustomType/index.ts | 14 ++-- .../wasm-as/CustomType/serialization.ts | 74 +++++++++---------- .../bind/sanity/output/wasm-as/Env/index.ts | 4 +- .../output/wasm-as/Env/serialization.ts | 12 +-- .../output/wasm-as/Module/serialization.ts | 40 +++++----- .../TestImport_AnotherObject/index.ts | 2 +- .../TestImport_AnotherObject/serialization.ts | 2 +- .../imported/TestImport_Module/index.ts | 2 +- .../TestImport_Module/serialization.ts | 28 +++---- .../imported/TestImport_Object/index.ts | 6 +- .../TestImport_Object/serialization.ts | 38 +++++----- .../as/assembly/__tests__/msgpack.spec.ts | 10 +-- .../as/assembly/__tests__/nullable.spec.ts | 17 ----- packages/wasm/as/assembly/index.ts | 10 +-- packages/wasm/as/assembly/msgpack/Nullable.ts | 55 -------------- packages/wasm/as/assembly/msgpack/Read.ts | 21 +++--- .../wasm/as/assembly/msgpack/ReadDecoder.ts | 57 +++++++------- packages/wasm/as/assembly/msgpack/Write.ts | 21 +++--- .../wasm/as/assembly/msgpack/WriteEncoder.ts | 57 +++++++------- .../wasm/as/assembly/msgpack/WriteSizer.ts | 57 +++++++------- packages/wasm/as/assembly/msgpack/index.ts | 1 - 31 files changed, 244 insertions(+), 317 deletions(-) delete mode 100644 packages/wasm/as/assembly/__tests__/nullable.spec.ts delete mode 100644 packages/wasm/as/assembly/msgpack/Nullable.ts diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/functions.ts b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/functions.ts index c8037e8545..1591b78e61 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/functions.ts +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/functions.ts @@ -50,13 +50,14 @@ export const toWasmInit: MustacheFn = () => { type = type.substring(0, type.length - 1); } else { const nullType = toWasm()(value, render); - const nullable = "Nullable"; + const nullable = "Option"; const nullOptional = "| null"; if (nullType.endsWith(nullOptional)) { return "null"; } else if (nullType.startsWith(nullable)) { - return `new ${nullType}()`; + type = nullType.substring(6); + return `Option.None${type}()`; } } @@ -227,7 +228,7 @@ const applyNullable = ( ) { return `${type} | null`; } else { - return `Nullable<${type}>`; + return `Option<${type}>`; } } else { return type; diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/deserialize_enum.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/deserialize_enum.mustache index 25ce5f5664..390ae595c0 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/deserialize_enum.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/deserialize_enum.mustache @@ -8,19 +8,19 @@ if (reader.isNextString()) { } {{/required}} {{^required}} -let value: Nullable; +let value: Option; if (!reader.isNextNil()) { if (reader.isNextString()) { - value = Nullable.fromValue( + value = Option.Some( Types.get{{type}}Value(reader.readString()) ); } else { - value = Nullable.fromValue( + value = Option.Some( reader.readInt32() ); - Types.sanitize{{type}}Value(value.value); + Types.sanitize{{type}}Value(value.unwrap()); } } else { - value = Nullable.fromNull(); + value = Option.None(); } {{/required}} diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/imported/module-type/index-ts.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/imported/module-type/index-ts.mustache index 1b2b569b9a..af1dfb53fa 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/imported/module-type/index-ts.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/imported/module-type/index-ts.mustache @@ -1,7 +1,7 @@ import { wrap_subinvoke, wrap_subinvokeImplementation, - Nullable, + Option, BigInt, BigNumber, JSON, diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/imported/module-type/serialization-ts.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/imported/module-type/serialization-ts.mustache index cbeab27539..842613e064 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/imported/module-type/serialization-ts.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/imported/module-type/serialization-ts.mustache @@ -70,7 +70,7 @@ export function write{{name}}Args( } export function deserialize{{name}}Result(buffer: ArrayBuffer): {{#return}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/return}} { - const context: Context = new Context("Deserializing imported module-type: {{name}}"); + const context: Context = new Context("Deserializing imported module-type: {{name}}"); const reader = new ReadDecoder(buffer, context); {{#return}} diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/imported/object-type/index-ts.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/imported/object-type/index-ts.mustache index ab841d2923..260f1f14f1 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/imported/object-type/index-ts.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/imported/object-type/index-ts.mustache @@ -1,7 +1,7 @@ import { Read, Write, - Nullable, + Option, BigInt, BigNumber, JSON, diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/module-type/serialization-ts.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/module-type/serialization-ts.mustache index e4ff00abd7..f4a4b0c88e 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/module-type/serialization-ts.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/module-type/serialization-ts.mustache @@ -9,7 +9,7 @@ export class Input_{{name}} { } export function deserialize{{name}}Args(argsBuf: ArrayBuffer): Input_{{name}} { - const context: Context = new Context("Deserializing module-type: {{name}}"); + const context: Context = new Context("Deserializing module-type: {{name}}"); {{#arguments.length}} const reader = new ReadDecoder(argsBuf, context); let numFields = reader.readMapLength(); diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/object-type/index-ts.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/object-type/index-ts.mustache index 9bdd689ad6..37031594f6 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/object-type/index-ts.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/object-type/index-ts.mustache @@ -1,7 +1,7 @@ import { Read, Write, - Nullable, + Option, BigInt, BigNumber, JSON, diff --git a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/serialization_imports.mustache b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/serialization_imports.mustache index 8aeb5aa792..9ded19f5d4 100644 --- a/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/serialization_imports.mustache +++ b/packages/schema/bind/src/bindings/assemblyscript/wasm-as/templates/serialization_imports.mustache @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Nullable, + Option, BigInt, BigNumber, JSON, diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/index.ts index cd97ce73c5..66c4600c3c 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/index.ts @@ -1,7 +1,7 @@ import { Read, Write, - Nullable, + Option, BigInt, BigNumber, JSON, diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/serialization.ts index f29e52aad3..ed4fbeff94 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/AnotherType/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Nullable, + Option, BigInt, BigNumber, JSON, diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/index.ts index 0edc7a7894..c6b44c7fda 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/index.ts @@ -1,7 +1,7 @@ import { Read, Write, - Nullable, + Option, BigInt, BigNumber, JSON, @@ -21,7 +21,7 @@ export class CustomType { str: string; optStr: string | null; u: u32; - optU: Nullable; + optU: Option; m_u8: u8; m_u16: u16; m_u32: u32; @@ -38,13 +38,13 @@ export class CustomType { bytes: ArrayBuffer; optBytes: ArrayBuffer | null; m_boolean: bool; - optBoolean: Nullable; + optBoolean: Option; uArray: Array; uOptArray: Array | null; - optUOptArray: Array> | null; + optUOptArray: Array> | null; optStrOptArray: Array | null; uArrayArray: Array>; - uOptArrayOptArray: Array> | null>; + uOptArrayOptArray: Array> | null>; uArrayOptArrayArray: Array> | null>; crazyArray: Array | null>> | null> | null; object: Types.AnotherType; @@ -52,9 +52,9 @@ export class CustomType { objectArray: Array; optObjectArray: Array | null; en: Types.CustomEnum; - optEnum: Nullable; + optEnum: Option; enumArray: Array; - optEnumArray: Array> | null; + optEnumArray: Array> | null; static toBuffer(type: CustomType): ArrayBuffer { return serializeCustomType(type); diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/serialization.ts index 2529b4cb63..5b8a71d97a 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/CustomType/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Nullable, + Option, BigInt, BigNumber, JSON, @@ -38,7 +38,7 @@ export function writeCustomType(writer: Write, type: CustomType): void { writer.writeString("u"); writer.writeUInt32(type.u); writer.context().pop(); - writer.context().push("optU", "Nullable", "writing property"); + writer.context().push("optU", "Option", "writing property"); writer.writeString("optU"); writer.writeNullableUInt32(type.optU); writer.context().pop(); @@ -106,7 +106,7 @@ export function writeCustomType(writer: Write, type: CustomType): void { writer.writeString("boolean"); writer.writeBool(type.m_boolean); writer.context().pop(); - writer.context().push("optBoolean", "Nullable", "writing property"); + writer.context().push("optBoolean", "Option", "writing property"); writer.writeString("optBoolean"); writer.writeNullableBool(type.optBoolean); writer.context().pop(); @@ -122,9 +122,9 @@ export function writeCustomType(writer: Write, type: CustomType): void { writer.writeUInt32(item); }); writer.context().pop(); - writer.context().push("optUOptArray", "Array> | null", "writing property"); + writer.context().push("optUOptArray", "Array> | null", "writing property"); writer.writeString("optUOptArray"); - writer.writeNullableArray(type.optUOptArray, (writer: Write, item: Nullable): void => { + writer.writeNullableArray(type.optUOptArray, (writer: Write, item: Option): void => { writer.writeNullableUInt32(item); }); writer.context().pop(); @@ -142,10 +142,10 @@ export function writeCustomType(writer: Write, type: CustomType): void { }); }); writer.context().pop(); - writer.context().push("uOptArrayOptArray", "Array> | null>", "writing property"); + writer.context().push("uOptArrayOptArray", "Array> | null>", "writing property"); writer.writeString("uOptArrayOptArray"); - writer.writeArray(type.uOptArrayOptArray, (writer: Write, item: Array> | null): void => { - writer.writeNullableArray(item, (writer: Write, item: Nullable): void => { + writer.writeArray(type.uOptArrayOptArray, (writer: Write, item: Array> | null): void => { + writer.writeNullableArray(item, (writer: Write, item: Option): void => { writer.writeNullableUInt32(item); }); }); @@ -204,7 +204,7 @@ export function writeCustomType(writer: Write, type: CustomType): void { writer.writeString("en"); writer.writeInt32(type.en); writer.context().pop(); - writer.context().push("optEnum", "Nullable", "writing property"); + writer.context().push("optEnum", "Option", "writing property"); writer.writeString("optEnum"); writer.writeNullableInt32(type.optEnum); writer.context().pop(); @@ -214,9 +214,9 @@ export function writeCustomType(writer: Write, type: CustomType): void { writer.writeInt32(item); }); writer.context().pop(); - writer.context().push("optEnumArray", "Array> | null", "writing property"); + writer.context().push("optEnumArray", "Array> | null", "writing property"); writer.writeString("optEnumArray"); - writer.writeNullableArray(type.optEnumArray, (writer: Write, item: Nullable): void => { + writer.writeNullableArray(type.optEnumArray, (writer: Write, item: Option): void => { writer.writeNullableInt32(item); }); writer.context().pop(); @@ -236,7 +236,7 @@ export function readCustomType(reader: Read): CustomType { let _optStr: string | null = null; let _u: u32 = 0; let _uSet: bool = false; - let _optU: Nullable = new Nullable(); + let _optU: Option = Option.None(); let _u8: u8 = 0; let _u8Set: bool = false; let _u16: u16 = 0; @@ -265,15 +265,15 @@ export function readCustomType(reader: Read): CustomType { let _optBytes: ArrayBuffer | null = null; let _boolean: bool = false; let _booleanSet: bool = false; - let _optBoolean: Nullable = new Nullable(); + let _optBoolean: Option = Option.None(); let _uArray: Array = []; let _uArraySet: bool = false; let _uOptArray: Array | null = null; - let _optUOptArray: Array> | null = null; + let _optUOptArray: Array> | null = null; let _optStrOptArray: Array | null = null; let _uArrayArray: Array> = []; let _uArrayArraySet: bool = false; - let _uOptArrayOptArray: Array> | null> = []; + let _uOptArrayOptArray: Array> | null> = []; let _uOptArrayOptArraySet: bool = false; let _uArrayOptArrayArray: Array> | null> = []; let _uArrayOptArrayArraySet: bool = false; @@ -286,10 +286,10 @@ export function readCustomType(reader: Read): CustomType { let _optObjectArray: Array | null = null; let _en: Types.CustomEnum = 0; let _enSet: bool = false; - let _optEnum: Nullable = new Nullable(); + let _optEnum: Option = Option.None(); let _enumArray: Array = []; let _enumArraySet: bool = false; - let _optEnumArray: Array> | null = null; + let _optEnumArray: Array> | null = null; while (numFields > 0) { numFields--; @@ -314,7 +314,7 @@ export function readCustomType(reader: Read): CustomType { reader.context().pop(); } else if (field == "optU") { - reader.context().push(field, "Nullable", "type found, reading property"); + reader.context().push(field, "Option", "type found, reading property"); _optU = reader.readNullableUInt32(); reader.context().pop(); } @@ -411,7 +411,7 @@ export function readCustomType(reader: Read): CustomType { reader.context().pop(); } else if (field == "optBoolean") { - reader.context().push(field, "Nullable", "type found, reading property"); + reader.context().push(field, "Option", "type found, reading property"); _optBoolean = reader.readNullableBool(); reader.context().pop(); } @@ -431,8 +431,8 @@ export function readCustomType(reader: Read): CustomType { reader.context().pop(); } else if (field == "optUOptArray") { - reader.context().push(field, "Array> | null", "type found, reading property"); - _optUOptArray = reader.readNullableArray((reader: Read): Nullable => { + reader.context().push(field, "Array> | null", "type found, reading property"); + _optUOptArray = reader.readNullableArray((reader: Read): Option => { return reader.readNullableUInt32(); }); reader.context().pop(); @@ -455,9 +455,9 @@ export function readCustomType(reader: Read): CustomType { reader.context().pop(); } else if (field == "uOptArrayOptArray") { - reader.context().push(field, "Array> | null>", "type found, reading property"); - _uOptArrayOptArray = reader.readArray((reader: Read): Array> | null => { - return reader.readNullableArray((reader: Read): Nullable => { + reader.context().push(field, "Array> | null>", "type found, reading property"); + _uOptArrayOptArray = reader.readArray((reader: Read): Array> | null => { + return reader.readNullableArray((reader: Read): Option => { return reader.readNullableUInt32(); }); }); @@ -539,21 +539,21 @@ export function readCustomType(reader: Read): CustomType { reader.context().pop(); } else if (field == "optEnum") { - reader.context().push(field, "Nullable", "type found, reading property"); - let value: Nullable; + reader.context().push(field, "Option", "type found, reading property"); + let value: Option; if (!reader.isNextNil()) { if (reader.isNextString()) { - value = Nullable.fromValue( + value = Option.Some( Types.getCustomEnumValue(reader.readString()) ); } else { - value = Nullable.fromValue( + value = Option.Some( reader.readInt32() ); - Types.sanitizeCustomEnumValue(value.value); + Types.sanitizeCustomEnumValue(value.unwrap()); } } else { - value = Nullable.fromNull(); + value = Option.None(); } _optEnum = value; reader.context().pop(); @@ -574,22 +574,22 @@ export function readCustomType(reader: Read): CustomType { reader.context().pop(); } else if (field == "optEnumArray") { - reader.context().push(field, "Array> | null", "type found, reading property"); - _optEnumArray = reader.readNullableArray((reader: Read): Nullable => { - let value: Nullable; + reader.context().push(field, "Array> | null", "type found, reading property"); + _optEnumArray = reader.readNullableArray((reader: Read): Option => { + let value: Option; if (!reader.isNextNil()) { if (reader.isNextString()) { - value = Nullable.fromValue( + value = Option.Some( Types.getCustomEnumValue(reader.readString()) ); } else { - value = Nullable.fromValue( + value = Option.Some( reader.readInt32() ); - Types.sanitizeCustomEnumValue(value.value); + Types.sanitizeCustomEnumValue(value.unwrap()); } } else { - value = Nullable.fromNull(); + value = Option.None(); } return value; }); diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/index.ts index 09dee2ac73..904a3bdb79 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/index.ts @@ -1,7 +1,7 @@ import { Read, Write, - Nullable, + Option, BigInt, BigNumber, JSON, @@ -20,7 +20,7 @@ import * as Types from ".."; export class Env { prop: string; optProp: string | null; - optMap: Map> | null; + optMap: Map> | null; static toBuffer(type: Env): ArrayBuffer { return serializeEnv(type); diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/serialization.ts index 601434c3e0..e83f1c9ca1 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/Env/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Nullable, + Option, BigInt, BigNumber, JSON, @@ -34,11 +34,11 @@ export function writeEnv(writer: Write, type: Env): void { writer.writeString("optProp"); writer.writeNullableString(type.optProp); writer.context().pop(); - writer.context().push("optMap", "Map> | null", "writing property"); + writer.context().push("optMap", "Map> | null", "writing property"); writer.writeString("optMap"); writer.writeNullableExtGenericMap(type.optMap, (writer: Write, key: string) => { writer.writeString(key); - }, (writer: Write, value: Nullable): void => { + }, (writer: Write, value: Option): void => { writer.writeNullableInt32(value); }); writer.context().pop(); @@ -56,7 +56,7 @@ export function readEnv(reader: Read): Env { let _prop: string = ""; let _propSet: bool = false; let _optProp: string | null = null; - let _optMap: Map> | null = null; + let _optMap: Map> | null = null; while (numFields > 0) { numFields--; @@ -75,10 +75,10 @@ export function readEnv(reader: Read): Env { reader.context().pop(); } else if (field == "optMap") { - reader.context().push(field, "Map> | null", "type found, reading property"); + reader.context().push(field, "Map> | null", "type found, reading property"); _optMap = reader.readNullableExtGenericMap((reader: Read): string => { return reader.readString(); - }, (reader: Read): Nullable => { + }, (reader: Read): Option => { return reader.readNullableInt32(); }); reader.context().pop(); diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/Module/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/Module/serialization.ts index 6ee48d0a3e..f214d2abae 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/Module/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/Module/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Nullable, + Option, BigInt, BigNumber, JSON, @@ -16,14 +16,14 @@ export class Input_moduleMethod { str: string; optStr: string | null; en: Types.CustomEnum; - optEnum: Nullable; + optEnum: Option; enumArray: Array; - optEnumArray: Array> | null; + optEnumArray: Array> | null; map: Map; } export function deserializemoduleMethodArgs(argsBuf: ArrayBuffer): Input_moduleMethod { - const context: Context = new Context("Deserializing module-type: moduleMethod"); + const context: Context = new Context("Deserializing module-type: moduleMethod"); const reader = new ReadDecoder(argsBuf, context); let numFields = reader.readMapLength(); @@ -32,10 +32,10 @@ export function deserializemoduleMethodArgs(argsBuf: ArrayBuffer): Input_moduleM let _optStr: string | null = null; let _en: Types.CustomEnum = 0; let _enSet: bool = false; - let _optEnum: Nullable = new Nullable(); + let _optEnum: Option = Option.None(); let _enumArray: Array = []; let _enumArraySet: bool = false; - let _optEnumArray: Array> | null = null; + let _optEnumArray: Array> | null = null; let _map: Map = new Map(); let _mapSet: bool = false; @@ -69,21 +69,21 @@ export function deserializemoduleMethodArgs(argsBuf: ArrayBuffer): Input_moduleM reader.context().pop(); } else if (field == "optEnum") { - reader.context().push(field, "Nullable", "type found, reading property"); - let value: Nullable; + reader.context().push(field, "Option", "type found, reading property"); + let value: Option; if (!reader.isNextNil()) { if (reader.isNextString()) { - value = Nullable.fromValue( + value = Option.Some( Types.getCustomEnumValue(reader.readString()) ); } else { - value = Nullable.fromValue( + value = Option.Some( reader.readInt32() ); - Types.sanitizeCustomEnumValue(value.value); + Types.sanitizeCustomEnumValue(value.unwrap()); } } else { - value = Nullable.fromNull(); + value = Option.None(); } _optEnum = value; reader.context().pop(); @@ -104,22 +104,22 @@ export function deserializemoduleMethodArgs(argsBuf: ArrayBuffer): Input_moduleM reader.context().pop(); } else if (field == "optEnumArray") { - reader.context().push(field, "Array> | null", "type found, reading property"); - _optEnumArray = reader.readNullableArray((reader: Read): Nullable => { - let value: Nullable; + reader.context().push(field, "Array> | null", "type found, reading property"); + _optEnumArray = reader.readNullableArray((reader: Read): Option => { + let value: Option; if (!reader.isNextNil()) { if (reader.isNextString()) { - value = Nullable.fromValue( + value = Option.Some( Types.getCustomEnumValue(reader.readString()) ); } else { - value = Nullable.fromValue( + value = Option.Some( reader.readInt32() ); - Types.sanitizeCustomEnumValue(value.value); + Types.sanitizeCustomEnumValue(value.unwrap()); } } else { - value = Nullable.fromNull(); + value = Option.None(); } return value; }); @@ -187,7 +187,7 @@ export class Input_objectMethod { } export function deserializeobjectMethodArgs(argsBuf: ArrayBuffer): Input_objectMethod { - const context: Context = new Context("Deserializing module-type: objectMethod"); + const context: Context = new Context("Deserializing module-type: objectMethod"); const reader = new ReadDecoder(argsBuf, context); let numFields = reader.readMapLength(); diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/index.ts index 6a52f417bb..2b53e96219 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/index.ts @@ -1,7 +1,7 @@ import { Read, Write, - Nullable, + Option, BigInt, BigNumber, JSON, diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/serialization.ts index cfbe766951..98b67d08ff 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_AnotherObject/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Nullable, + Option, BigInt, BigNumber, JSON, diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Module/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Module/index.ts index 5246bae2bd..859818f55b 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Module/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Module/index.ts @@ -1,7 +1,7 @@ import { wrap_subinvoke, wrap_subinvokeImplementation, - Nullable, + Option, BigInt, BigNumber, JSON, diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Module/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Module/serialization.ts index 65a08566f7..d1bb72d7e5 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Module/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Module/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Nullable, + Option, BigInt, BigNumber, JSON, @@ -16,16 +16,16 @@ export class Input_importedMethod { str: string; optStr: string | null; u: u32; - optU: Nullable; - uArrayArray: Array> | null>; + optU: Option; + uArrayArray: Array> | null>; object: Types.TestImport_Object; optObject: Types.TestImport_Object | null; objectArray: Array; optObjectArray: Array | null; en: Types.TestImport_Enum; - optEnum: Nullable; + optEnum: Option; enumArray: Array; - optEnumArray: Array> | null; + optEnumArray: Array> | null; } export function serializeimportedMethodArgs(input: Input_importedMethod): ArrayBuffer { @@ -56,14 +56,14 @@ export function writeimportedMethodArgs( writer.writeString("u"); writer.writeUInt32(input.u); writer.context().pop(); - writer.context().push("optU", "Nullable", "writing property"); + writer.context().push("optU", "Option", "writing property"); writer.writeString("optU"); writer.writeNullableUInt32(input.optU); writer.context().pop(); - writer.context().push("uArrayArray", "Array> | null>", "writing property"); + writer.context().push("uArrayArray", "Array> | null>", "writing property"); writer.writeString("uArrayArray"); - writer.writeArray(input.uArrayArray, (writer: Write, item: Array> | null): void => { - writer.writeNullableArray(item, (writer: Write, item: Nullable): void => { + writer.writeArray(input.uArrayArray, (writer: Write, item: Array> | null): void => { + writer.writeNullableArray(item, (writer: Write, item: Option): void => { writer.writeNullableUInt32(item); }); }); @@ -100,7 +100,7 @@ export function writeimportedMethodArgs( writer.writeString("en"); writer.writeInt32(input.en); writer.context().pop(); - writer.context().push("optEnum", "Nullable", "writing property"); + writer.context().push("optEnum", "Option", "writing property"); writer.writeString("optEnum"); writer.writeNullableInt32(input.optEnum); writer.context().pop(); @@ -110,16 +110,16 @@ export function writeimportedMethodArgs( writer.writeInt32(item); }); writer.context().pop(); - writer.context().push("optEnumArray", "Array> | null", "writing property"); + writer.context().push("optEnumArray", "Array> | null", "writing property"); writer.writeString("optEnumArray"); - writer.writeNullableArray(input.optEnumArray, (writer: Write, item: Nullable): void => { + writer.writeNullableArray(input.optEnumArray, (writer: Write, item: Option): void => { writer.writeNullableInt32(item); }); writer.context().pop(); } export function deserializeimportedMethodResult(buffer: ArrayBuffer): Types.TestImport_Object | null { - const context: Context = new Context("Deserializing imported module-type: importedMethod"); + const context: Context = new Context("Deserializing imported module-type: importedMethod"); const reader = new ReadDecoder(buffer, context); reader.context().push("importedMethod", "Types.TestImport_Object | null", "reading function output"); @@ -162,7 +162,7 @@ export function writeanotherMethodArgs( } export function deserializeanotherMethodResult(buffer: ArrayBuffer): i32 { - const context: Context = new Context("Deserializing imported module-type: anotherMethod"); + const context: Context = new Context("Deserializing imported module-type: anotherMethod"); const reader = new ReadDecoder(buffer, context); reader.context().push("anotherMethod", "i32", "reading function output"); diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/index.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/index.ts index fc03152ed8..192e0901cc 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/index.ts @@ -1,7 +1,7 @@ import { Read, Write, - Nullable, + Option, BigInt, BigNumber, JSON, @@ -26,9 +26,9 @@ export class TestImport_Object { objectArray: Array; optObjectArray: Array | null; en: Types.TestImport_Enum; - optEnum: Nullable; + optEnum: Option; enumArray: Array; - optEnumArray: Array> | null; + optEnumArray: Array> | null; static toBuffer(type: TestImport_Object): ArrayBuffer { return serializeTestImport_Object(type); diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/serialization.ts b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/serialization.ts index 623dcdc2d5..9b588e9ca7 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/serialization.ts +++ b/packages/test-cases/cases/bind/sanity/output/wasm-as/imported/TestImport_Object/serialization.ts @@ -4,7 +4,7 @@ import { Write, WriteSizer, WriteEncoder, - Nullable, + Option, BigInt, BigNumber, JSON, @@ -58,7 +58,7 @@ export function writeTestImport_Object(writer: Write, type: TestImport_Object): writer.writeString("en"); writer.writeInt32(type.en); writer.context().pop(); - writer.context().push("optEnum", "Nullable", "writing property"); + writer.context().push("optEnum", "Option", "writing property"); writer.writeString("optEnum"); writer.writeNullableInt32(type.optEnum); writer.context().pop(); @@ -68,9 +68,9 @@ export function writeTestImport_Object(writer: Write, type: TestImport_Object): writer.writeInt32(item); }); writer.context().pop(); - writer.context().push("optEnumArray", "Array> | null", "writing property"); + writer.context().push("optEnumArray", "Array> | null", "writing property"); writer.writeString("optEnumArray"); - writer.writeNullableArray(type.optEnumArray, (writer: Write, item: Nullable): void => { + writer.writeNullableArray(type.optEnumArray, (writer: Write, item: Option): void => { writer.writeNullableInt32(item); }); writer.context().pop(); @@ -93,10 +93,10 @@ export function readTestImport_Object(reader: Read): TestImport_Object { let _optObjectArray: Array | null = null; let _en: Types.TestImport_Enum = 0; let _enSet: bool = false; - let _optEnum: Nullable = new Nullable(); + let _optEnum: Option = Option.None(); let _enumArray: Array = []; let _enumArraySet: bool = false; - let _optEnumArray: Array> | null = null; + let _optEnumArray: Array> | null = null; while (numFields > 0) { numFields--; @@ -153,21 +153,21 @@ export function readTestImport_Object(reader: Read): TestImport_Object { reader.context().pop(); } else if (field == "optEnum") { - reader.context().push(field, "Nullable", "type found, reading property"); - let value: Nullable; + reader.context().push(field, "Option", "type found, reading property"); + let value: Option; if (!reader.isNextNil()) { if (reader.isNextString()) { - value = Nullable.fromValue( + value = Option.Some( Types.getTestImport_EnumValue(reader.readString()) ); } else { - value = Nullable.fromValue( + value = Option.Some( reader.readInt32() ); - Types.sanitizeTestImport_EnumValue(value.value); + Types.sanitizeTestImport_EnumValue(value.unwrap()); } } else { - value = Nullable.fromNull(); + value = Option.None(); } _optEnum = value; reader.context().pop(); @@ -188,22 +188,22 @@ export function readTestImport_Object(reader: Read): TestImport_Object { reader.context().pop(); } else if (field == "optEnumArray") { - reader.context().push(field, "Array> | null", "type found, reading property"); - _optEnumArray = reader.readNullableArray((reader: Read): Nullable => { - let value: Nullable; + reader.context().push(field, "Array> | null", "type found, reading property"); + _optEnumArray = reader.readNullableArray((reader: Read): Option => { + let value: Option; if (!reader.isNextNil()) { if (reader.isNextString()) { - value = Nullable.fromValue( + value = Option.Some( Types.getTestImport_EnumValue(reader.readString()) ); } else { - value = Nullable.fromValue( + value = Option.Some( reader.readInt32() ); - Types.sanitizeTestImport_EnumValue(value.value); + Types.sanitizeTestImport_EnumValue(value.unwrap()); } } else { - value = Nullable.fromNull(); + value = Option.None(); } return value; }); diff --git a/packages/wasm/as/assembly/__tests__/msgpack.spec.ts b/packages/wasm/as/assembly/__tests__/msgpack.spec.ts index 44ccfdbcc7..e63ef0a802 100644 --- a/packages/wasm/as/assembly/__tests__/msgpack.spec.ts +++ b/packages/wasm/as/assembly/__tests__/msgpack.spec.ts @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/no-inferrable-types */ import { - Nullable, Read, ReadDecoder, Write, @@ -11,6 +10,7 @@ import { BigInt, BigNumber, } from "../"; +import { Option } from "as-container"; class Sanity { nil: string | null = "null"; @@ -21,8 +21,8 @@ class Sanity { uint16: u16; uint32: u32; boolean: bool; - optUint32: Nullable = new Nullable(); - optBool: Nullable = new Nullable(); + optUint32: Option = Option.None(); + optBool: Option = Option.None(); float32: f32; float64: f64; str: string = ""; @@ -49,8 +49,8 @@ class Sanity { this.uint16 = 65535; this.uint32 = 4294967295; this.boolean = true; - this.optUint32 = Nullable.fromValue(234234234); - this.optBool = Nullable.fromValue(true); + this.optUint32 = Option.Some(234234234); + this.optBool = Option.Some(true); this.float32 = 3.40282344818115234375; this.float64 = 3124124512.598273468017578125; this.str = "Hello, world!"; diff --git a/packages/wasm/as/assembly/__tests__/nullable.spec.ts b/packages/wasm/as/assembly/__tests__/nullable.spec.ts deleted file mode 100644 index 424731136b..0000000000 --- a/packages/wasm/as/assembly/__tests__/nullable.spec.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Nullable } from "../msgpack/Nullable"; - -describe("Nullable: Sanity", () => { - it("Works", () => { - const value = Nullable.fromValue(500); - const other = Nullable.fromNull(); - - expect(value.value).toBe(500); - expect(other).not.toBe(value); - - expect(value == other).toBe(false); - expect(value != other).toBe(true); - - const sameValue = Nullable.fromValue(value.value); - expect(sameValue == value).toBe(true); - }); -}); diff --git a/packages/wasm/as/assembly/index.ts b/packages/wasm/as/assembly/index.ts index ffacda0174..372b974bd4 100644 --- a/packages/wasm/as/assembly/index.ts +++ b/packages/wasm/as/assembly/index.ts @@ -1,11 +1,5 @@ -export { - Read, - ReadDecoder, - Write, - WriteEncoder, - WriteSizer, - Nullable, -} from "./msgpack"; +export { Option } from "as-container"; +export { Read, ReadDecoder, Write, WriteEncoder, WriteSizer } from "./msgpack"; export * from "./json"; export * from "./math"; export * from "./containers"; diff --git a/packages/wasm/as/assembly/msgpack/Nullable.ts b/packages/wasm/as/assembly/msgpack/Nullable.ts deleted file mode 100644 index 3165d50f07..0000000000 --- a/packages/wasm/as/assembly/msgpack/Nullable.ts +++ /dev/null @@ -1,55 +0,0 @@ -// Only class and string types can be -// "nullable" using the `| null` notation. -// Nullable is used for nullable value types. -// https://www.assemblyscript.org/types.html#type-rules -export class Nullable { - private _value: T; - private _nil: bool; - - constructor() { - this.toNull(); - } - - static fromValue(value: T): Nullable { - const nullable = new Nullable(); - nullable.value = value; - return nullable; - } - - static fromNull(): Nullable { - return new Nullable(); - } - - get value(): T { - return this._value; - } - - set value(arg: T) { - this._value = arg; - this._nil = false; - } - - get isNull(): bool { - return this._nil; - } - - toNull(): void { - this._nil = true; - } - - @inline - @operator("==") - protected eq(rhs: Nullable): bool { - if (this._nil) { - return this._nil == rhs._nil; - } else { - return !(rhs._nil || this._value != rhs._value); - } - } - - @inline - @operator("!=") - protected neq(rhs: Nullable): bool { - return !this.eq(rhs); - } -} diff --git a/packages/wasm/as/assembly/msgpack/Read.ts b/packages/wasm/as/assembly/msgpack/Read.ts index 09517b9f0e..317623afbc 100644 --- a/packages/wasm/as/assembly/msgpack/Read.ts +++ b/packages/wasm/as/assembly/msgpack/Read.ts @@ -1,8 +1,9 @@ -import { Nullable } from "./Nullable"; import { BigInt, BigNumber } from "../math"; import { Context } from "../debug"; import { JSON } from "../json"; +import { Option } from "as-container"; + export abstract class Read { abstract readBool(): bool; abstract readInt8(): i8; @@ -32,15 +33,15 @@ export abstract class Read { value_fn: (reader: Read) => V ): Map; - abstract readNullableBool(): Nullable; - abstract readNullableInt8(): Nullable; - abstract readNullableInt16(): Nullable; - abstract readNullableInt32(): Nullable; - abstract readNullableUInt8(): Nullable; - abstract readNullableUInt16(): Nullable; - abstract readNullableUInt32(): Nullable; - abstract readNullableFloat32(): Nullable; - abstract readNullableFloat64(): Nullable; + abstract readNullableBool(): Option; + abstract readNullableInt8(): Option; + abstract readNullableInt16(): Option; + abstract readNullableInt32(): Option; + abstract readNullableUInt8(): Option; + abstract readNullableUInt16(): Option; + abstract readNullableUInt32(): Option; + abstract readNullableFloat32(): Option; + abstract readNullableFloat64(): Option; abstract readNullableString(): string | null; abstract readNullableBytes(): ArrayBuffer | null; abstract readNullableBigInt(): BigInt | null; diff --git a/packages/wasm/as/assembly/msgpack/ReadDecoder.ts b/packages/wasm/as/assembly/msgpack/ReadDecoder.ts index f276810161..3a902eb81e 100644 --- a/packages/wasm/as/assembly/msgpack/ReadDecoder.ts +++ b/packages/wasm/as/assembly/msgpack/ReadDecoder.ts @@ -9,13 +9,14 @@ import { isFixedArray, isFixedString, } from "./Format"; -import { Nullable } from "./Nullable"; import { Read } from "./Read"; import { BigInt, BigNumber } from "../math"; import { Context } from "../debug"; import { JSON } from "../json"; import { ExtensionType } from "./ExtensionType"; +import { Option } from "as-container"; + export class ReadDecoder extends Read { private readonly _context: Context; private _view: DataView; @@ -363,67 +364,67 @@ export class ReadDecoder extends Read { return this.readMap(key_fn, value_fn); } - readNullableBool(): Nullable { + readNullableBool(): Option { if (this.isNextNil()) { - return Nullable.fromNull(); + return Option.None(); } - return Nullable.fromValue(this.readBool()); + return Option.Some(this.readBool()); } - readNullableInt8(): Nullable { + readNullableInt8(): Option { if (this.isNextNil()) { - return Nullable.fromNull(); + return Option.None(); } - return Nullable.fromValue(this.readInt8()); + return Option.Some(this.readInt8()); } - readNullableInt16(): Nullable { + readNullableInt16(): Option { if (this.isNextNil()) { - return Nullable.fromNull(); + return Option.None(); } - return Nullable.fromValue(this.readInt16()); + return Option.Some(this.readInt16()); } - readNullableInt32(): Nullable { + readNullableInt32(): Option { if (this.isNextNil()) { - return Nullable.fromNull(); + return Option.None(); } - return Nullable.fromValue(this.readInt32()); + return Option.Some(this.readInt32()); } - readNullableUInt8(): Nullable { + readNullableUInt8(): Option { if (this.isNextNil()) { - return Nullable.fromNull(); + return Option.None(); } - return Nullable.fromValue(this.readUInt8()); + return Option.Some(this.readUInt8()); } - readNullableUInt16(): Nullable { + readNullableUInt16(): Option { if (this.isNextNil()) { - return Nullable.fromNull(); + return Option.None(); } - return Nullable.fromValue(this.readUInt16()); + return Option.Some(this.readUInt16()); } - readNullableUInt32(): Nullable { + readNullableUInt32(): Option { if (this.isNextNil()) { - return Nullable.fromNull(); + return Option.None(); } - return Nullable.fromValue(this.readUInt32()); + return Option.Some(this.readUInt32()); } - readNullableFloat32(): Nullable { + readNullableFloat32(): Option { if (this.isNextNil()) { - return Nullable.fromNull(); + return Option.None(); } - return Nullable.fromValue(this.readFloat32()); + return Option.Some(this.readFloat32()); } - readNullableFloat64(): Nullable { + readNullableFloat64(): Option { if (this.isNextNil()) { - return Nullable.fromNull(); + return Option.None(); } - return Nullable.fromValue(this.readFloat64()); + return Option.Some(this.readFloat64()); } readNullableString(): string | null { diff --git a/packages/wasm/as/assembly/msgpack/Write.ts b/packages/wasm/as/assembly/msgpack/Write.ts index b02a9ebbbf..f7ff982686 100644 --- a/packages/wasm/as/assembly/msgpack/Write.ts +++ b/packages/wasm/as/assembly/msgpack/Write.ts @@ -1,8 +1,9 @@ -import { Nullable } from "./Nullable"; import { BigInt, BigNumber } from "../math"; import { Context } from "../debug"; import { JSON } from "../json"; +import { Option } from "as-container"; + export abstract class Write { abstract writeNil(): void; abstract writeBool(value: bool): void; @@ -38,15 +39,15 @@ export abstract class Write { value_fn: (writer: Write, value: V) => void ): void; - abstract writeNullableBool(value: Nullable): void; - abstract writeNullableInt8(value: Nullable): void; - abstract writeNullableInt16(value: Nullable): void; - abstract writeNullableInt32(value: Nullable): void; - abstract writeNullableUInt8(value: Nullable): void; - abstract writeNullableUInt16(value: Nullable): void; - abstract writeNullableUInt32(value: Nullable): void; - abstract writeNullableFloat32(value: Nullable): void; - abstract writeNullableFloat64(value: Nullable): void; + abstract writeNullableBool(value: Option): void; + abstract writeNullableInt8(value: Option): void; + abstract writeNullableInt16(value: Option): void; + abstract writeNullableInt32(value: Option): void; + abstract writeNullableUInt8(value: Option): void; + abstract writeNullableUInt16(value: Option): void; + abstract writeNullableUInt32(value: Option): void; + abstract writeNullableFloat32(value: Option): void; + abstract writeNullableFloat64(value: Option): void; abstract writeNullableString(value: string | null): void; abstract writeNullableBytes(value: ArrayBuffer | null): void; abstract writeNullableBigInt(value: BigInt | null): void; diff --git a/packages/wasm/as/assembly/msgpack/WriteEncoder.ts b/packages/wasm/as/assembly/msgpack/WriteEncoder.ts index 8763a348ed..02140973b5 100644 --- a/packages/wasm/as/assembly/msgpack/WriteEncoder.ts +++ b/packages/wasm/as/assembly/msgpack/WriteEncoder.ts @@ -2,13 +2,14 @@ import { DataView } from "./DataView"; import { WriteSizer } from "./WriteSizer"; import { Format } from "./Format"; import { ExtensionType } from "./ExtensionType"; -import { Nullable } from "./Nullable"; import { Write } from "./Write"; import { throwArrayIndexOutOfRange } from "./utils"; import { BigInt, BigNumber } from "../math"; import { Context } from "../debug"; import { JSON } from "../json"; +import { Option } from "as-container"; + export class WriteEncoder extends Write { private readonly _context: Context; private _view: DataView; @@ -234,85 +235,85 @@ export class WriteEncoder extends Write { this.writeMap(m, key_fn, value_fn); } - writeNullableBool(value: Nullable): void { - if (value.isNull) { + writeNullableBool(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeBool(value.value); + this.writeBool(value.unwrap()); } - writeNullableInt8(value: Nullable): void { - if (value.isNull) { + writeNullableInt8(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeInt8(value.value); + this.writeInt8(value.unwrap()); } - writeNullableInt16(value: Nullable): void { - if (value.isNull) { + writeNullableInt16(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeInt16(value.value); + this.writeInt16(value.unwrap()); } - writeNullableInt32(value: Nullable): void { - if (value.isNull) { + writeNullableInt32(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeInt32(value.value); + this.writeInt32(value.unwrap()); } - writeNullableUInt8(value: Nullable): void { - if (value.isNull) { + writeNullableUInt8(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeUInt8(value.value); + this.writeUInt8(value.unwrap()); } - writeNullableUInt16(value: Nullable): void { - if (value.isNull) { + writeNullableUInt16(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeUInt16(value.value); + this.writeUInt16(value.unwrap()); } - writeNullableUInt32(value: Nullable): void { - if (value.isNull) { + writeNullableUInt32(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeUInt32(value.value); + this.writeUInt32(value.unwrap()); } - writeNullableFloat32(value: Nullable): void { - if (value.isNull) { + writeNullableFloat32(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeFloat32(value.value); + this.writeFloat32(value.unwrap()); } - writeNullableFloat64(value: Nullable): void { - if (value.isNull) { + writeNullableFloat64(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeFloat64(value.value); + this.writeFloat64(value.unwrap()); } writeNullableString(value: string | null): void { diff --git a/packages/wasm/as/assembly/msgpack/WriteSizer.ts b/packages/wasm/as/assembly/msgpack/WriteSizer.ts index f88aaf639f..4b32fd07c9 100644 --- a/packages/wasm/as/assembly/msgpack/WriteSizer.ts +++ b/packages/wasm/as/assembly/msgpack/WriteSizer.ts @@ -1,9 +1,10 @@ import { Write } from "./Write"; -import { Nullable } from "./Nullable"; import { BigInt, BigNumber } from "../math"; import { Context } from "../debug"; import { JSON } from "../json"; +import { Option } from "as-container"; + export class WriteSizer extends Write { length: i32; extByteLengths: Array; @@ -194,85 +195,85 @@ export class WriteSizer extends Write { this.extByteLengths.push(byteLength); } - writeNullableBool(value: Nullable): void { - if (value.isNull) { + writeNullableBool(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeBool(value.value); + this.writeBool(value.unwrap()); } - writeNullableInt8(value: Nullable): void { - if (value.isNull) { + writeNullableInt8(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeInt8(value.value); + this.writeInt8(value.unwrap()); } - writeNullableInt16(value: Nullable): void { - if (value.isNull) { + writeNullableInt16(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeInt16(value.value); + this.writeInt16(value.unwrap()); } - writeNullableInt32(value: Nullable): void { - if (value.isNull) { + writeNullableInt32(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeInt32(value.value); + this.writeInt32(value.unwrap()); } - writeNullableUInt8(value: Nullable): void { - if (value.isNull) { + writeNullableUInt8(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeUInt8(value.value); + this.writeUInt8(value.unwrap()); } - writeNullableUInt16(value: Nullable): void { - if (value.isNull) { + writeNullableUInt16(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeUInt16(value.value); + this.writeUInt16(value.unwrap()); } - writeNullableUInt32(value: Nullable): void { - if (value.isNull) { + writeNullableUInt32(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeUInt32(value.value); + this.writeUInt32(value.unwrap()); } - writeNullableFloat32(value: Nullable): void { - if (value.isNull) { + writeNullableFloat32(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeFloat32(value.value); + this.writeFloat32(value.unwrap()); } - writeNullableFloat64(value: Nullable): void { - if (value.isNull) { + writeNullableFloat64(value: Option): void { + if (value.isNone) { this.writeNil(); return; } - this.writeFloat64(value.value); + this.writeFloat64(value.unwrap()); } writeNullableString(value: string | null): void { diff --git a/packages/wasm/as/assembly/msgpack/index.ts b/packages/wasm/as/assembly/msgpack/index.ts index 1ed14b50e4..0f7d2c3630 100644 --- a/packages/wasm/as/assembly/msgpack/index.ts +++ b/packages/wasm/as/assembly/msgpack/index.ts @@ -3,4 +3,3 @@ export * from "./ReadDecoder"; export * from "./Write"; export * from "./WriteEncoder"; export * from "./WriteSizer"; -export * from "./Nullable"; From 8e329f3eeff2abb197acf79396161b359d0dc7bb Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Thu, 23 Jun 2022 09:46:00 -0700 Subject: [PATCH 31/38] chore: remove docker buildx output option --- packages/cli/src/lib/Compiler.ts | 10 ---------- packages/cli/src/lib/system/docker.ts | 6 +----- .../formats/polywrap.build/0.0.1-prealpha.3.ts | 4 ---- .../manifest/formats/polywrap.build/validate.ts | 1 - packages/js/core/src/manifest/validators.ts | 16 ---------------- .../formats/polywrap.build/0.0.1-prealpha.3.json | 5 ----- 6 files changed, 1 insertion(+), 41 deletions(-) diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index e519ee6206..1fefd3427d 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -292,7 +292,6 @@ export class Compiler { const useBuildx = !!dockerBuildxConfig; let cacheDir: string | undefined; - let buildxOutput: string | undefined; let removeBuilder = false; if (dockerBuildxConfig && typeof dockerBuildxConfig !== "boolean") { @@ -310,14 +309,6 @@ export class Compiler { } } - const output = dockerBuildxConfig.output; - - if (output === true) { - buildxOutput = "docker"; - } else if (typeof output === "string") { - buildxOutput = output; - } - removeBuilder = !!dockerBuildxConfig.removeBuilder; } @@ -334,7 +325,6 @@ export class Compiler { imageName, dockerfile, cacheDir, - buildxOutput, useBuildx, project.quiet ); diff --git a/packages/cli/src/lib/system/docker.ts b/packages/cli/src/lib/system/docker.ts index 89630acd07..b41dc05218 100644 --- a/packages/cli/src/lib/system/docker.ts +++ b/packages/cli/src/lib/system/docker.ts @@ -118,7 +118,6 @@ export async function createBuildImage( imageName: string, dockerfile: string, cacheDir?: string, - buildxOutput?: string, useBuildx = false, quiet = true ): Promise { @@ -131,9 +130,6 @@ export async function createBuildImage( ? `--cache-from type=local,src=${cacheDir}` : ""; const cacheTo = cacheDir ? `--cache-to type=local,dest=${cacheDir}` : ""; - const output = buildxOutput - ? `--output=type=${buildxOutput}` - : `--output=type=docker`; // Build the docker image let buildxUseFailed: boolean; @@ -151,7 +147,7 @@ export async function createBuildImage( ); } await runCommand( - `docker buildx build -f ${dockerfile} -t ${imageName} ${rootDir} ${cacheFrom} ${cacheTo} ${output}`, + `docker buildx build -f ${dockerfile} -t ${imageName} ${rootDir} ${cacheFrom} ${cacheTo} --output=type=docker`, quiet ); } else { diff --git a/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.3.ts b/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.3.ts index 4f4655d5aa..640fa904bd 100644 --- a/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.3.ts +++ b/packages/js/core/src/manifest/formats/polywrap.build/0.0.1-prealpha.3.ts @@ -33,10 +33,6 @@ export interface BuildManifest { * Path to cache directory, set to true for default value, set to false to disable caching. */ cache?: string | boolean; - /** - * Path to cache directory, set to true or false for default value. - */ - output?: string | boolean; /** * Remove the builder instance. */ diff --git a/packages/js/core/src/manifest/formats/polywrap.build/validate.ts b/packages/js/core/src/manifest/formats/polywrap.build/validate.ts index ffa751200f..ca7d90c93c 100644 --- a/packages/js/core/src/manifest/formats/polywrap.build/validate.ts +++ b/packages/js/core/src/manifest/formats/polywrap.build/validate.ts @@ -38,7 +38,6 @@ Validator.prototype.customFormats.dockerfileName = Validators.dockerfileName; Validator.prototype.customFormats.dockerImageId = Validators.dockerImageId; Validator.prototype.customFormats.regexString = Validators.regexString; Validator.prototype.customFormats.directory = Validators.directory; -Validator.prototype.customFormats.buildxOutput = Validators.buildxOutput; export const validateBuildManifest = Tracer.traceFunc( "core: validateBuildManifest", diff --git a/packages/js/core/src/manifest/validators.ts b/packages/js/core/src/manifest/validators.ts index 066e0499da..667bd1204e 100644 --- a/packages/js/core/src/manifest/validators.ts +++ b/packages/js/core/src/manifest/validators.ts @@ -140,19 +140,3 @@ export function directory(path: unknown): boolean { return !!validDirRegex.test(path); } - -export function buildxOutput(output: unknown): boolean { - if (typeof output === "boolean") { - return true; - } - if (typeof output !== "string") { - return false; - } - switch (output) { - case "docker": - case "registry": - return true; - default: - return false; - } -} diff --git a/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.3.json b/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.3.json index 5b7b5bda19..081d963775 100644 --- a/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.3.json +++ b/packages/manifest-schemas/formats/polywrap.build/0.0.1-prealpha.3.json @@ -38,11 +38,6 @@ "type": ["string", "boolean"], "format": "directory" }, - "output": { - "description": "Path to cache directory, set to true or false for default value.", - "type": ["string", "boolean"], - "format": "buildxOutput" - }, "removeBuilder": { "description": "Remove the builder instance.", "type": "boolean" From a6666a25e4464fb0464d37d0f3461317d9998fac Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Thu, 23 Jun 2022 10:25:35 -0700 Subject: [PATCH 32/38] add back template tests --- packages/cli/src/__tests__/e2e/create.spec.ts | 3 +-- .../src/__tests__/e2e/test/test/package.json | 5 ---- .../app/typescript-node/polywrap.app.yaml | 3 +++ packages/templates/run-tests.ts | 13 +++++----- yarn.lock | 24 +++++++++---------- 5 files changed, 22 insertions(+), 26 deletions(-) delete mode 100644 packages/cli/src/__tests__/e2e/test/test/package.json create mode 100644 packages/templates/app/typescript-node/polywrap.app.yaml diff --git a/packages/cli/src/__tests__/e2e/create.spec.ts b/packages/cli/src/__tests__/e2e/create.spec.ts index c8a0c3317f..eefc1f442a 100644 --- a/packages/cli/src/__tests__/e2e/create.spec.ts +++ b/packages/cli/src/__tests__/e2e/create.spec.ts @@ -98,8 +98,7 @@ describe("e2e tests for create command", () => { expect(output).toBe(""); }); - // TODO: re-enable this post-polywrap init release - test.skip("Should successfully generate project", async () => { + test("Should successfully generate project", async () => { rimraf.sync(`${__dirname}/test`); const { exitCode: code, stdout: output } = await runCLI({ diff --git a/packages/cli/src/__tests__/e2e/test/test/package.json b/packages/cli/src/__tests__/e2e/test/test/package.json deleted file mode 100644 index 47cd757a44..0000000000 --- a/packages/cli/src/__tests__/e2e/test/test/package.json +++ /dev/null @@ -1,5 +0,0 @@ - -{ - "name": "template" -} - \ No newline at end of file diff --git a/packages/templates/app/typescript-node/polywrap.app.yaml b/packages/templates/app/typescript-node/polywrap.app.yaml new file mode 100644 index 0000000000..bbed2041c9 --- /dev/null +++ b/packages/templates/app/typescript-node/polywrap.app.yaml @@ -0,0 +1,3 @@ +format: 0.0.1-prealpha.1 +language: app/typescript +schema: ./schema.graphql diff --git a/packages/templates/run-tests.ts b/packages/templates/run-tests.ts index 2160faff36..454933ea29 100644 --- a/packages/templates/run-tests.ts +++ b/packages/templates/run-tests.ts @@ -14,19 +14,18 @@ const languageTestCommands: Record = { "yarn test" ], "typescript-node": [ - // Add this back once new toolchain version is released - /*"yarn build", - "yarn test"*/ + // Uncomment when the helloworld wrapper has been deployed to polywrap.eth + // "yarn build", + // "yarn test" ], "typescript-react": [ - // Add this back once new toolchain version is released + // Uncomment when the helloworld wrapper has been deployed to polywrap.eth // "CI=false yarn build" ], "assemblyscript": [ - // Add this back once new toolchain version is released - /*"yarn build", + "yarn build", "yarn test:e2e", - "yarn test:recipe"*/ + "yarn test:recipe" ], "interface": [ "yarn build" diff --git a/yarn.lock b/yarn.lock index c4327bce52..340596b44c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7285,9 +7285,9 @@ electron-fetch@^1.7.2: encoding "^0.1.13" electron-to-chromium@^1.3.378, electron-to-chromium@^1.4.164: - version "1.4.164" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.164.tgz#3d0f5c83557d8ec8a7faa531e498f198c3bd974a" - integrity sha512-K7iy5y6XyP9Pzh3uaDti0KC4JUNT6T1tLG5RTOmesqq2YgAJpYYYJ32m+anvZYjCV35llPTEh87kvEV/uSsiyQ== + version "1.4.167" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.167.tgz#72424aebc85df12c5331d37b1bcfd1ae01322c55" + integrity sha512-lPHuHXBwpkr4RcfaZBKm6TKOWG/1N9mVggUpP4fY3l1JIUU2x4fkM8928smYdZ5lF+6KCTAxo1aK9JmqT+X71Q== elliptic@6.5.4, elliptic@^6.5.3: version "6.5.4" @@ -9311,9 +9311,9 @@ http-errors@~1.6.2: statuses ">= 1.4.0 < 2" http-parser-js@>=0.5.1: - version "0.5.6" - resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.5.6.tgz#2e02406ab2df8af8a7abfba62e0da01c62b95afd" - integrity sha512-vDlkRPDJn93swjcjqMSaGSPABbIarsr1TLAui/gLDXzV5VsJNdXNzMYDyNBLQkjWQCJ1uizu8T2oDMhmGt0PRA== + version "0.5.7" + resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.5.7.tgz#39bde369fb8a57235121bb69d05f079fa1b598f4" + integrity sha512-8gQM8ZcewlONQLnik2AKzS13euQhaZcu4rK5QBSYOszW0T1upLW9VA2MdWvTvMmRo42HjXp7igFmdROoBCCrfg== http-proxy-agent@^4.0.1: version "4.0.1" @@ -12740,9 +12740,9 @@ multicodec@^3.0.1: varint "^6.0.0" multiformats@^9.4.2: - version "9.6.5" - resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-9.6.5.tgz#f2d894a26664b454a90abf5a8911b7e39195db80" - integrity sha512-vMwf/FUO+qAPvl3vlSZEgEVFY/AxeZq5yg761ScF3CZsXgmTi/HGkicUiNN0CI4PW8FiY2P0OLklOcmQjdQJhw== + version "9.7.0" + resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-9.7.0.tgz#845799e8df70fbb6b15922500e45cb87cf12f7e5" + integrity sha512-uv/tcgwk0yN4DStopnBN4GTgvaAlYdy6KnZpuzEPFOYQd71DYFJjs0MN1ERElAflrZaYyGBWXyGxL5GgrxIx0Q== multihashes@^0.4.15, multihashes@~0.4.15, multihashes@~0.4.19: version "0.4.21" @@ -17626,9 +17626,9 @@ upath@^2.0.1: integrity sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w== update-browserslist-db@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.3.tgz#6c47cb996f34afb363e924748e2f6e4d983c6fc1" - integrity sha512-ufSazemeh9Gty0qiWtoRpJ9F5Q5W3xdIPm1UZQqYQv/q0Nyb9EMHUB2lu+O9x1re9WsorpMAUu4Y6Lxcs5n+XQ== + version "1.0.4" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.4.tgz#dbfc5a789caa26b1db8990796c2c8ebbce304824" + integrity sha512-jnmO2BEGUjsMOe/Fg9u0oczOe/ppIDZPebzccl1yDWGLFP16Pa1/RM5wEoKYPG2zstNcDuAStejyxsOuKINdGA== dependencies: escalade "^3.1.1" picocolors "^1.0.0" From ce3144b4ebc2fa72d24c31cf6667fdf9337da25b Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Thu, 23 Jun 2022 10:38:24 -0700 Subject: [PATCH 33/38] change output type from docker to image --- packages/cli/src/lib/system/docker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/lib/system/docker.ts b/packages/cli/src/lib/system/docker.ts index b41dc05218..0f073bdd22 100644 --- a/packages/cli/src/lib/system/docker.ts +++ b/packages/cli/src/lib/system/docker.ts @@ -147,7 +147,7 @@ export async function createBuildImage( ); } await runCommand( - `docker buildx build -f ${dockerfile} -t ${imageName} ${rootDir} ${cacheFrom} ${cacheTo} --output=type=docker`, + `docker buildx build -f ${dockerfile} -t ${imageName} ${rootDir} ${cacheFrom} ${cacheTo} --output=type=image`, quiet ); } else { From d7f8b6b246885513826aad8e0c6acb7c00be476c Mon Sep 17 00:00:00 2001 From: namesty Date: Thu, 23 Jun 2022 21:02:07 +0200 Subject: [PATCH 34/38] prep 0.0.1-prealpha.89 --- CHANGELOG.md | 15 +++++++++++++++ VERSION | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24d440a7c7..8d17fafc5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +# Polywrap 0.0.1-prealpha.89 +## Features +* [PR-903](https://github.com/polywrap/monorepo/pull/903) `polywrap`: Recipes have been re-worked into composable workflows, and they can be run using CLI commands. +* [PR-951](https://github.com/polywrap/monorepo/pull/951) `polywrap`: Docker Buildx output option has been removed. +* [PR-944](https://github.com/polywrap/monorepo/pull/944) `@polywrap/schema-bind`, `@polywrap/wasm-as`: `Nullable` type has been replaced with `Option` in the Assemblyscript schema bindings. +* [PR-938](https://github.com/polywrap/monorepo/pull/938) `@polywrap/schema-bind`, `@polywrap/wasm-as`: Rollback of JSON serialization in the Assemblyscript schema bindings. + +## Bugs +* [PR-946](https://github.com/polywrap/monorepo/pull/946) `@polywrap/test-env-js`: Path fix for `npmCLI` test utility. + +## Breaking Changes +* [PR-903](https://github.com/polywrap/monorepo/pull/903) Recipes have been deprecated in favor of workflows. +* [PR-944](https://github.com/polywrap/monorepo/pull/944) `Nullable` type has been removed in favor of `Option` which also has a different interface. +* [PR-938](https://github.com/polywrap/monorepo/pull/938) `JSON` serializer and deserializer, and related methods `fromJson` and `toJson` have been removed in favor of `parse` and `stringify`. + # Polywrap 0.0.1-prealpha.88 ## Bugs * Various CI/CD fixes. diff --git a/VERSION b/VERSION index 8f9a849c50..5bf85935b0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.1-prealpha.88 +0.0.1-prealpha.89 From b59d65a4df2c55f1bcd318bb0f61526493c841a3 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Thu, 23 Jun 2022 13:08:59 -0700 Subject: [PATCH 35/38] fix wasm/assemblyscript template --- packages/templates/run-tests.ts | 6 +- .../templates/wasm/assemblyscript/README.md | 3 +- .../wasm/assemblyscript/package.json | 7 +-- .../wasm/assemblyscript/recipes/e2e.json | 43 ------------- .../assemblyscript/scripts/deploy-contract.js | 60 ------------------- .../assemblyscript/workflows/config.ts | 0 .../assemblyscript/workflows/e2e.yaml | 9 ++- yarn.lock | 14 ++++- 8 files changed, 26 insertions(+), 116 deletions(-) delete mode 100644 packages/templates/wasm/assemblyscript/recipes/e2e.json delete mode 100644 packages/templates/wasm/assemblyscript/scripts/deploy-contract.js rename packages/templates/{api => wasm}/assemblyscript/workflows/config.ts (100%) rename packages/templates/{api => wasm}/assemblyscript/workflows/e2e.yaml (65%) diff --git a/packages/templates/run-tests.ts b/packages/templates/run-tests.ts index ffc8cb76b0..bdd38afc7c 100644 --- a/packages/templates/run-tests.ts +++ b/packages/templates/run-tests.ts @@ -23,8 +23,10 @@ const languageTestCommands: Record = { // "CI=false yarn build" ], "assemblyscript": [ - "yarn build", - "yarn test" + // Uncomment when the wasm/as package has been redeployed + // "yarn build", + // "yarn test:e2e" + // "yarn test:workflow" ], "interface": [ "yarn build" diff --git a/packages/templates/wasm/assemblyscript/README.md b/packages/templates/wasm/assemblyscript/README.md index 19c4da62d8..58bc0b0d11 100644 --- a/packages/templates/wasm/assemblyscript/README.md +++ b/packages/templates/wasm/assemblyscript/README.md @@ -11,4 +11,5 @@ A simple starter template that uses a SimpleStorage.sol contract ethereum. For m `yarn build` ## Test -`yarn test` +`yarn test:e2e` +`yarn test:workflow` diff --git a/packages/templates/wasm/assemblyscript/package.json b/packages/templates/wasm/assemblyscript/package.json index 0ef4baca56..a70b42977d 100644 --- a/packages/templates/wasm/assemblyscript/package.json +++ b/packages/templates/wasm/assemblyscript/package.json @@ -9,13 +9,10 @@ "build:contract": "node ./scripts/build-contract.js", "test:env:up": "npx polywrap infra up --modules=eth-ens-ipfs", "test:env:down": "npx polywrap infra down --modules=eth-ens-ipfs", - "deploy": "yarn deploy:contract && yarn deploy:polywrap", - "deploy:polywrap": "npx polywrap deploy", - "deploy:contract": "node ./scripts/deploy-contract.js", - "test": "yarn test:e2e && yarn test:recipe", + "deploy": "npx polywrap deploy", "test:e2e": "yarn build && yarn test:e2e:codegen && jest --passWithNoTests --runInBand --verbose", "test:e2e:codegen": "npx polywrap app codegen -m ./src/__tests__/types/polywrap.app.yaml -c ./src/__tests__/types/wrap", - "test:recipe": "yarn build && yarn test:env:up && yarn deploy:contract && npx polywrap query ./recipes/e2e.json && yarn test:env:down" + "test:workflow": "yarn build && yarn test:env:up && sleep 5 && npx polywrap run ./workflows/e2e.yaml && yarn test:env:down" }, "devDependencies": { "@polywrap/ethereum-plugin-js": "0.0.1-prealpha.88", diff --git a/packages/templates/wasm/assemblyscript/recipes/e2e.json b/packages/templates/wasm/assemblyscript/recipes/e2e.json deleted file mode 100644 index 33aeabdfce..0000000000 --- a/packages/templates/wasm/assemblyscript/recipes/e2e.json +++ /dev/null @@ -1,43 +0,0 @@ -[ - { - "wrapper": "wrap://fs/./build", - "constants": "./constants.json" - }, - { - "query": "./get.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "network": "testnet" - } - }, - { - "query": "./set.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "value": 5, - "network": "testnet" - } - }, - { - "query": "./get.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "network": "testnet" - } - }, - { - "query": "./set.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "value": 569, - "network": "testnet" - } - }, - { - "query": "./get.graphql", - "variables": { - "address": "$SimpleStorageAddr", - "network": "testnet" - } - } -] diff --git a/packages/templates/wasm/assemblyscript/scripts/deploy-contract.js b/packages/templates/wasm/assemblyscript/scripts/deploy-contract.js deleted file mode 100644 index 471d10c40c..0000000000 --- a/packages/templates/wasm/assemblyscript/scripts/deploy-contract.js +++ /dev/null @@ -1,60 +0,0 @@ -const buildContract = require("./build-contract"); -const { initTestEnvironment, stopTestEnvironment, providers } = require("@polywrap/test-env-js"); -const { EthereumPlugin } = require("@polywrap/ethereum-plugin-js"); -const fs = require("fs"); - -async function main() { - // Ensure the contract is built - await buildContract.main(); - await initTestEnvironment() - // Fetch the contract's ABI - const contractAbi = JSON.parse( - fs.readFileSync( - `${__dirname}/../src/contracts/SimpleStorage.json`, 'utf-8' - ) - ); - - // Deploy the contract to testnet - const eth = new EthereumPlugin({ - networks: { - testnet: { - provider: providers.ethereum - }, - }, - }); - - const address = await eth.deployContract({ - abi: contractAbi.abi, - bytecode: contractAbi.bytecode, - args: [], - connection: { - networkNameOrChainId: "testnet" - } - }); - - console.log(`✔️ SimpleStorage live at: ${address}`) - - // Store the address in our recipes' constants file - const constants = require(`${__dirname}/../recipes/constants.json`); - constants.SimpleStorageAddr = address; - fs.writeFileSync( - `${__dirname}/../recipes/constants.json`, - JSON.stringify(constants, null, 2) - ); - - console.log("✔️ Recipe Constants Updated"); -} - -if (require.main === module) { - main() - .then(() => process.exit(0)) - .catch(async (error) => { - await stopTestEnvironment() - console.error(error); - process.exit(1); - }); -} else { - module.exports = { - main - }; -} diff --git a/packages/templates/api/assemblyscript/workflows/config.ts b/packages/templates/wasm/assemblyscript/workflows/config.ts similarity index 100% rename from packages/templates/api/assemblyscript/workflows/config.ts rename to packages/templates/wasm/assemblyscript/workflows/config.ts diff --git a/packages/templates/api/assemblyscript/workflows/e2e.yaml b/packages/templates/wasm/assemblyscript/workflows/e2e.yaml similarity index 65% rename from packages/templates/api/assemblyscript/workflows/e2e.yaml rename to packages/templates/wasm/assemblyscript/workflows/e2e.yaml index 8d66b4ab90..5ed90fa0db 100644 --- a/packages/templates/api/assemblyscript/workflows/e2e.yaml +++ b/packages/templates/wasm/assemblyscript/workflows/e2e.yaml @@ -5,7 +5,8 @@ jobs: - uri: fs/build method: deployContract input: - connection: null + connection: + networkNameOrChainId: testnet jobs: case1: steps: @@ -14,9 +15,11 @@ jobs: input: address: "$cases.0.data" value: 100 - connection: null + connection: + networkNameOrChainId: testnet - uri: fs/build method: getData input: address: "$cases.0.data" - connection: null + connection: + networkNameOrChainId: testnet diff --git a/yarn.lock b/yarn.lock index b6616eeb46..ff8727b724 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5604,11 +5604,16 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" 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.30001349: +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001035, caniuse-lite@^1.0.30001109: version "1.0.30001357" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001357.tgz#dec7fc4158ef6ad24690d0eec7b91f32b8cb1b5d" integrity sha512-b+KbWHdHePp+ZpNj+RDHFChZmuN+J5EvuQUlee9jOQIUAdhv9uvAZeEtUeLAknXbkiu1uxjQ9NLp1ie894CuWg== +caniuse-lite@^1.0.30001358: + version "1.0.30001358" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001358.tgz#473d35dabf5e448b463095cab7924e96ccfb8c00" + integrity sha512-hvp8PSRymk85R20bsDra7ZTCpSVGN/PAz9pSAjPSjKC+rNmnUk5vCRgJwiTT/O4feQ/yu/drvZYpKxxhbFuChw== + capture-exit@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" @@ -7284,11 +7289,16 @@ electron-fetch@^1.7.2: dependencies: encoding "^0.1.13" -electron-to-chromium@^1.3.378, electron-to-chromium@^1.4.147: +electron-to-chromium@^1.3.378: version "1.4.161" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.161.tgz#49cb5b35385bfee6cc439d0a04fbba7a7a7f08a1" integrity sha512-sTjBRhqh6wFodzZtc5Iu8/R95OkwaPNn7tj/TaDU5nu/5EFiQDtADGAXdR4tJcTEHlYfJpHqigzJqHvPgehP8A== +electron-to-chromium@^1.4.164: + version "1.4.167" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.167.tgz#72424aebc85df12c5331d37b1bcfd1ae01322c55" + integrity sha512-lPHuHXBwpkr4RcfaZBKm6TKOWG/1N9mVggUpP4fY3l1JIUU2x4fkM8928smYdZ5lF+6KCTAxo1aK9JmqT+X71Q== + elliptic@6.5.4, elliptic@^6.5.3: version "6.5.4" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" From d531b4bf3f45cbf254cb3a90a37bbb8b4c843c71 Mon Sep 17 00:00:00 2001 From: Jure Bogunovic Date: Thu, 23 Jun 2022 22:09:49 +0200 Subject: [PATCH 36/38] added wait for ens deployment when starting test env --- packages/js/test-env/src/index.ts | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/packages/js/test-env/src/index.ts b/packages/js/test-env/src/index.ts index 2b46e1bdcd..d73341954b 100644 --- a/packages/js/test-env/src/index.ts +++ b/packages/js/test-env/src/index.ts @@ -67,6 +67,12 @@ export const initTestEnvironment = async (cli?: string): Promise => { cli, }); + if (exitCode) { + throw Error( + `initTestEnvironment failed to start test environment.\nExit Code: ${exitCode}\nStdErr: ${stderr}\nStdOut: ${stdout}` + ); + } + // Wait for all endpoints to become available let success = false; @@ -97,14 +103,19 @@ export const initTestEnvironment = async (cli?: string): Promise => { throw Error("test-env: Ganache failed to start"); } - if (exitCode) { - throw Error( - `initTestEnvironment failed to start test environment.\nExit Code: ${exitCode}\nStdErr: ${stderr}\nStdOut: ${stdout}` - ); - } + // ENS + success = await awaitResponse( + "http://localhost:8545", + '"result":"0x', + "post", + 2000, + 20000, + `{"jsonrpc":"2.0","method":"eth_getCode","params":["${ensAddresses.ensAddress}", "0x2"],"id":1}` + ); - // Wait an extra couple of seconds for the ens deployment to finish - await new Promise((resolve) => setTimeout(resolve, 3000)); + if (!success) { + throw Error("test-env: ENS failed to deploy"); + } }; export const stopTestEnvironment = async (cli?: string): Promise => { From 7e6b07871b4bba68fe4b0d6b01ef8d4f1f957cf7 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Thu, 23 Jun 2022 13:33:02 -0700 Subject: [PATCH 37/38] default docker buildx output type back to docker --- packages/cli/src/lib/system/docker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/lib/system/docker.ts b/packages/cli/src/lib/system/docker.ts index 0f073bdd22..b41dc05218 100644 --- a/packages/cli/src/lib/system/docker.ts +++ b/packages/cli/src/lib/system/docker.ts @@ -147,7 +147,7 @@ export async function createBuildImage( ); } await runCommand( - `docker buildx build -f ${dockerfile} -t ${imageName} ${rootDir} ${cacheFrom} ${cacheTo} --output=type=image`, + `docker buildx build -f ${dockerfile} -t ${imageName} ${rootDir} ${cacheFrom} ${cacheTo} --output=type=docker`, quiet ); } else { From 974742c835c2d9eb00c61d1896cd784340cfb89f Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Thu, 23 Jun 2022 13:39:10 -0700 Subject: [PATCH 38/38] modify changelog --- CHANGELOG.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d17fafc5b..1b6e0e3548 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Polywrap 0.0.1-prealpha.89 ## Features -* [PR-903](https://github.com/polywrap/monorepo/pull/903) `polywrap`: Recipes have been re-worked into composable workflows, and they can be run using CLI commands. -* [PR-951](https://github.com/polywrap/monorepo/pull/951) `polywrap`: Docker Buildx output option has been removed. +* [PR-903](https://github.com/polywrap/monorepo/pull/903) `polywrap` CLI: Recipes have been re-worked into composable workflows, and they can be run using CLI commands. +* [PR-951](https://github.com/polywrap/monorepo/pull/951) `polywrap` CLI: Docker Buildx output option has been removed. * [PR-944](https://github.com/polywrap/monorepo/pull/944) `@polywrap/schema-bind`, `@polywrap/wasm-as`: `Nullable` type has been replaced with `Option` in the Assemblyscript schema bindings. * [PR-938](https://github.com/polywrap/monorepo/pull/938) `@polywrap/schema-bind`, `@polywrap/wasm-as`: Rollback of JSON serialization in the Assemblyscript schema bindings. @@ -9,9 +9,9 @@ * [PR-946](https://github.com/polywrap/monorepo/pull/946) `@polywrap/test-env-js`: Path fix for `npmCLI` test utility. ## Breaking Changes -* [PR-903](https://github.com/polywrap/monorepo/pull/903) Recipes have been deprecated in favor of workflows. -* [PR-944](https://github.com/polywrap/monorepo/pull/944) `Nullable` type has been removed in favor of `Option` which also has a different interface. -* [PR-938](https://github.com/polywrap/monorepo/pull/938) `JSON` serializer and deserializer, and related methods `fromJson` and `toJson` have been removed in favor of `parse` and `stringify`. +* [PR-903](https://github.com/polywrap/monorepo/pull/903) `polywrap` CLI: Running recipes via the `polywrap query ...` command has been deprecated in favor of a new workflows system, accessible via the `polywrap run ...` command. +* [PR-944](https://github.com/polywrap/monorepo/pull/944) `wasm/assemblyscript` Wrappers: `Nullable` type has been removed in favor of `Option` which also has a different interface. +* [PR-938](https://github.com/polywrap/monorepo/pull/938) `wasm/assemblyscript` Wrappers: `JSON` serializer and deserializer, and related methods `fromJson` and `toJson` have been removed in favor of `parse` and `stringify`. # Polywrap 0.0.1-prealpha.88 ## Bugs