From d2ba46cb934977f60a6b5fead46612a4a91a70ce Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Mon, 12 Dec 2022 22:03:31 -0500 Subject: [PATCH 1/2] feat: typescript codegen - export imported method arg interfaces --- .../app/templates/types-ts.mustache | 2 +- .../plugin/templates/module-ts.mustache | 2 + .../plugin/templates/types-ts.mustache | 2 +- .../cases/bind/sanity/output/app-ts/types.ts | 6 +- .../bind/sanity/output/plugin-ts/module.ts | 2 + .../bind/sanity/output/plugin-ts/types.ts | 6 +- .../001-sanity/expected/wrap/module.ts | 2 + .../codegen/001-sanity/expected/wrap/types.ts | 58 +++++++++---------- .../002-single-module/expected/wrap/module.ts | 2 + .../002-single-module/expected/wrap/types.ts | 58 +++++++++---------- .../005-custom-config/expected/wrap/module.ts | 2 + .../005-custom-config/expected/wrap/types.ts | 58 +++++++++---------- .../expected/wrap/module.ts | 2 + .../expected/wrap/types.ts | 58 +++++++++---------- 14 files changed, 136 insertions(+), 124 deletions(-) diff --git a/packages/schema/bind/src/bindings/typescript/app/templates/types-ts.mustache b/packages/schema/bind/src/bindings/typescript/app/templates/types-ts.mustache index bc03dca396..853464ef83 100644 --- a/packages/schema/bind/src/bindings/typescript/app/templates/types-ts.mustache +++ b/packages/schema/bind/src/bindings/typescript/app/templates/types-ts.mustache @@ -88,7 +88,7 @@ export type {{#detectKeyword}}{{type}}{{/detectKeyword}} = {{type}}Enum | {{type {{#methods}} /* URI: "{{parent.uri}}" */ -interface {{parent.type}}_Args_{{name}} { +export interface {{parent.type}}_Args_{{name}} { {{#arguments}} {{name}}{{^required}}?{{/required}}: {{#toTypescript}}{{toGraphQLType}}{{/toTypescript}}; {{/arguments}} diff --git a/packages/schema/bind/src/bindings/typescript/plugin/templates/module-ts.mustache b/packages/schema/bind/src/bindings/typescript/plugin/templates/module-ts.mustache index dac08c0e51..4441891954 100644 --- a/packages/schema/bind/src/bindings/typescript/plugin/templates/module-ts.mustache +++ b/packages/schema/bind/src/bindings/typescript/plugin/templates/module-ts.mustache @@ -1,8 +1,10 @@ /// NOTE: This is an auto-generated file. /// All modifications will be overwritten. +// @ts-ignore import * as Types from "./types"; +// @ts-ignore import { CoreClient, MaybeAsync } from "@polywrap/core-js"; import { PluginModule } from "@polywrap/plugin-js"; {{#moduleType}} diff --git a/packages/schema/bind/src/bindings/typescript/plugin/templates/types-ts.mustache b/packages/schema/bind/src/bindings/typescript/plugin/templates/types-ts.mustache index e7eb717357..766c7850fd 100644 --- a/packages/schema/bind/src/bindings/typescript/plugin/templates/types-ts.mustache +++ b/packages/schema/bind/src/bindings/typescript/plugin/templates/types-ts.mustache @@ -99,7 +99,7 @@ export type {{#detectKeyword}}{{type}}{{/detectKeyword}} = {{type}}Enum | {{type {{#importedModuleTypes}} {{#methods}} /* URI: "{{parent.uri}}" */ -interface {{parent.type}}_Args_{{name}} { +export interface {{parent.type}}_Args_{{name}} { {{#arguments}} {{name}}{{^required}}?{{/required}}: {{#toTypescript}}{{toGraphQLType}}{{/toTypescript}}; {{/arguments}} diff --git a/packages/test-cases/cases/bind/sanity/output/app-ts/types.ts b/packages/test-cases/cases/bind/sanity/output/app-ts/types.ts index df0a780c98..324afbbf2c 100644 --- a/packages/test-cases/cases/bind/sanity/output/app-ts/types.ts +++ b/packages/test-cases/cases/bind/sanity/output/app-ts/types.ts @@ -155,7 +155,7 @@ export type TestImport_Enum_Return = TestImport_Enum_ReturnEnum | TestImport_Enu /// Imported Modules START /// /* URI: "testimport.uri.eth" */ -interface TestImport_Module_Args_importedMethod { +export interface TestImport_Module_Args_importedMethod { str: Types.String; optStr?: Types.String | null; u: Types.UInt; @@ -172,12 +172,12 @@ interface TestImport_Module_Args_importedMethod { } /* URI: "testimport.uri.eth" */ -interface TestImport_Module_Args_anotherMethod { +export interface TestImport_Module_Args_anotherMethod { arg: Array; } /* URI: "testimport.uri.eth" */ -interface TestImport_Module_Args_returnsArrayOfEnums { +export interface TestImport_Module_Args_returnsArrayOfEnums { arg: Types.String; } diff --git a/packages/test-cases/cases/bind/sanity/output/plugin-ts/module.ts b/packages/test-cases/cases/bind/sanity/output/plugin-ts/module.ts index 50b99303d6..4f8dcb6dbb 100644 --- a/packages/test-cases/cases/bind/sanity/output/plugin-ts/module.ts +++ b/packages/test-cases/cases/bind/sanity/output/plugin-ts/module.ts @@ -1,8 +1,10 @@ /// NOTE: This is an auto-generated file. /// All modifications will be overwritten. +// @ts-ignore import * as Types from "./types"; +// @ts-ignore import { CoreClient, MaybeAsync } from "@polywrap/core-js"; import { PluginModule } from "@polywrap/plugin-js"; diff --git a/packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts b/packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts index ee8e1a9efc..768504cf4b 100644 --- a/packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts +++ b/packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts @@ -169,7 +169,7 @@ export type TestImport_Enum_Return = TestImport_Enum_ReturnEnum | TestImport_Enu /// Imported Modules START /// /* URI: "testimport.uri.eth" */ -interface TestImport_Module_Args_importedMethod { +export interface TestImport_Module_Args_importedMethod { str: Types.String; optStr?: Types.String | null; u: Types.UInt; @@ -186,12 +186,12 @@ interface TestImport_Module_Args_importedMethod { } /* URI: "testimport.uri.eth" */ -interface TestImport_Module_Args_anotherMethod { +export interface TestImport_Module_Args_anotherMethod { arg: Array; } /* URI: "testimport.uri.eth" */ -interface TestImport_Module_Args_returnsArrayOfEnums { +export interface TestImport_Module_Args_returnsArrayOfEnums { arg: Types.String; } diff --git a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/module.ts b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/module.ts index d08b1a1fda..8a1f0fd9f1 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/module.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/module.ts @@ -1,8 +1,10 @@ /// NOTE: This is an auto-generated file. /// All modifications will be overwritten. +// @ts-ignore import * as Types from "./types"; +// @ts-ignore import { CoreClient, MaybeAsync } from "@polywrap/core-js"; import { PluginModule } from "@polywrap/plugin-js"; diff --git a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/types.ts b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/types.ts index 229d451eb9..aeaaa9db29 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/types.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/types.ts @@ -159,7 +159,7 @@ export interface Ethereum_Access { /// Imported Modules START /// /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractView { +export interface Ethereum_Module_Args_callContractView { address: Types.String; method: Types.String; args?: Array | null; @@ -167,7 +167,7 @@ interface Ethereum_Module_Args_callContractView { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractStatic { +export interface Ethereum_Module_Args_callContractStatic { address: Types.String; method: Types.String; args?: Array | null; @@ -176,72 +176,72 @@ interface Ethereum_Module_Args_callContractStatic { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getBalance { +export interface Ethereum_Module_Args_getBalance { address: Types.String; blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_encodeParams { +export interface Ethereum_Module_Args_encodeParams { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_encodeFunction { +export interface Ethereum_Module_Args_encodeFunction { method: Types.String; args?: Array | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_solidityPack { +export interface Ethereum_Module_Args_solidityPack { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_solidityKeccak256 { +export interface Ethereum_Module_Args_solidityKeccak256 { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_soliditySha256 { +export interface Ethereum_Module_Args_soliditySha256 { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerAddress { +export interface Ethereum_Module_Args_getSignerAddress { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerBalance { +export interface Ethereum_Module_Args_getSignerBalance { blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerTransactionCount { +export interface Ethereum_Module_Args_getSignerTransactionCount { blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getGasPrice { +export interface Ethereum_Module_Args_getGasPrice { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_estimateTransactionGas { +export interface Ethereum_Module_Args_estimateTransactionGas { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_estimateContractCallGas { +export interface Ethereum_Module_Args_estimateContractCallGas { address: Types.String; method: Types.String; args?: Array | null; @@ -250,22 +250,22 @@ interface Ethereum_Module_Args_estimateContractCallGas { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_checkAddress { +export interface Ethereum_Module_Args_checkAddress { address: Types.String; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_toWei { +export interface Ethereum_Module_Args_toWei { eth: Types.String; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_toEth { +export interface Ethereum_Module_Args_toEth { wei: Types.BigInt; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_awaitTransaction { +export interface Ethereum_Module_Args_awaitTransaction { txHash: Types.String; confirmations: Types.UInt32; timeout: Types.UInt32; @@ -273,7 +273,7 @@ interface Ethereum_Module_Args_awaitTransaction { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_waitForEvent { +export interface Ethereum_Module_Args_waitForEvent { address: Types.String; event: Types.String; args?: Array | null; @@ -282,17 +282,17 @@ interface Ethereum_Module_Args_waitForEvent { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getNetwork { +export interface Ethereum_Module_Args_getNetwork { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_requestAccounts { +export interface Ethereum_Module_Args_requestAccounts { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractMethod { +export interface Ethereum_Module_Args_callContractMethod { address: Types.String; method: Types.String; args?: Array | null; @@ -301,7 +301,7 @@ interface Ethereum_Module_Args_callContractMethod { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractMethodAndWait { +export interface Ethereum_Module_Args_callContractMethodAndWait { address: Types.String; method: Types.String; args?: Array | null; @@ -310,19 +310,19 @@ interface Ethereum_Module_Args_callContractMethodAndWait { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendTransaction { +export interface Ethereum_Module_Args_sendTransaction { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendTransactionAndWait { +export interface Ethereum_Module_Args_sendTransactionAndWait { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_deployContract { +export interface Ethereum_Module_Args_deployContract { abi: Types.String; bytecode: Types.String; args?: Array | null; @@ -330,19 +330,19 @@ interface Ethereum_Module_Args_deployContract { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_signMessage { +export interface Ethereum_Module_Args_signMessage { message: Types.String; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_signMessageBytes { +export interface Ethereum_Module_Args_signMessageBytes { bytes: Types.Bytes; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendRPC { +export interface Ethereum_Module_Args_sendRPC { method: Types.String; params: Array; connection?: Types.Ethereum_Connection | null; diff --git a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/module.ts b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/module.ts index 0643894c24..e74a2c7a62 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/module.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/module.ts @@ -1,8 +1,10 @@ /// NOTE: This is an auto-generated file. /// All modifications will be overwritten. +// @ts-ignore import * as Types from "./types"; +// @ts-ignore import { CoreClient, MaybeAsync } from "@polywrap/core-js"; import { PluginModule } from "@polywrap/plugin-js"; diff --git a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/types.ts b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/types.ts index 229d451eb9..aeaaa9db29 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/types.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/types.ts @@ -159,7 +159,7 @@ export interface Ethereum_Access { /// Imported Modules START /// /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractView { +export interface Ethereum_Module_Args_callContractView { address: Types.String; method: Types.String; args?: Array | null; @@ -167,7 +167,7 @@ interface Ethereum_Module_Args_callContractView { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractStatic { +export interface Ethereum_Module_Args_callContractStatic { address: Types.String; method: Types.String; args?: Array | null; @@ -176,72 +176,72 @@ interface Ethereum_Module_Args_callContractStatic { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getBalance { +export interface Ethereum_Module_Args_getBalance { address: Types.String; blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_encodeParams { +export interface Ethereum_Module_Args_encodeParams { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_encodeFunction { +export interface Ethereum_Module_Args_encodeFunction { method: Types.String; args?: Array | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_solidityPack { +export interface Ethereum_Module_Args_solidityPack { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_solidityKeccak256 { +export interface Ethereum_Module_Args_solidityKeccak256 { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_soliditySha256 { +export interface Ethereum_Module_Args_soliditySha256 { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerAddress { +export interface Ethereum_Module_Args_getSignerAddress { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerBalance { +export interface Ethereum_Module_Args_getSignerBalance { blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerTransactionCount { +export interface Ethereum_Module_Args_getSignerTransactionCount { blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getGasPrice { +export interface Ethereum_Module_Args_getGasPrice { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_estimateTransactionGas { +export interface Ethereum_Module_Args_estimateTransactionGas { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_estimateContractCallGas { +export interface Ethereum_Module_Args_estimateContractCallGas { address: Types.String; method: Types.String; args?: Array | null; @@ -250,22 +250,22 @@ interface Ethereum_Module_Args_estimateContractCallGas { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_checkAddress { +export interface Ethereum_Module_Args_checkAddress { address: Types.String; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_toWei { +export interface Ethereum_Module_Args_toWei { eth: Types.String; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_toEth { +export interface Ethereum_Module_Args_toEth { wei: Types.BigInt; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_awaitTransaction { +export interface Ethereum_Module_Args_awaitTransaction { txHash: Types.String; confirmations: Types.UInt32; timeout: Types.UInt32; @@ -273,7 +273,7 @@ interface Ethereum_Module_Args_awaitTransaction { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_waitForEvent { +export interface Ethereum_Module_Args_waitForEvent { address: Types.String; event: Types.String; args?: Array | null; @@ -282,17 +282,17 @@ interface Ethereum_Module_Args_waitForEvent { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getNetwork { +export interface Ethereum_Module_Args_getNetwork { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_requestAccounts { +export interface Ethereum_Module_Args_requestAccounts { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractMethod { +export interface Ethereum_Module_Args_callContractMethod { address: Types.String; method: Types.String; args?: Array | null; @@ -301,7 +301,7 @@ interface Ethereum_Module_Args_callContractMethod { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractMethodAndWait { +export interface Ethereum_Module_Args_callContractMethodAndWait { address: Types.String; method: Types.String; args?: Array | null; @@ -310,19 +310,19 @@ interface Ethereum_Module_Args_callContractMethodAndWait { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendTransaction { +export interface Ethereum_Module_Args_sendTransaction { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendTransactionAndWait { +export interface Ethereum_Module_Args_sendTransactionAndWait { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_deployContract { +export interface Ethereum_Module_Args_deployContract { abi: Types.String; bytecode: Types.String; args?: Array | null; @@ -330,19 +330,19 @@ interface Ethereum_Module_Args_deployContract { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_signMessage { +export interface Ethereum_Module_Args_signMessage { message: Types.String; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_signMessageBytes { +export interface Ethereum_Module_Args_signMessageBytes { bytes: Types.Bytes; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendRPC { +export interface Ethereum_Module_Args_sendRPC { method: Types.String; params: Array; connection?: Types.Ethereum_Connection | null; diff --git a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/module.ts b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/module.ts index d08b1a1fda..8a1f0fd9f1 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/module.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/module.ts @@ -1,8 +1,10 @@ /// NOTE: This is an auto-generated file. /// All modifications will be overwritten. +// @ts-ignore import * as Types from "./types"; +// @ts-ignore import { CoreClient, MaybeAsync } from "@polywrap/core-js"; import { PluginModule } from "@polywrap/plugin-js"; diff --git a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/types.ts b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/types.ts index 229d451eb9..aeaaa9db29 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/types.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/types.ts @@ -159,7 +159,7 @@ export interface Ethereum_Access { /// Imported Modules START /// /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractView { +export interface Ethereum_Module_Args_callContractView { address: Types.String; method: Types.String; args?: Array | null; @@ -167,7 +167,7 @@ interface Ethereum_Module_Args_callContractView { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractStatic { +export interface Ethereum_Module_Args_callContractStatic { address: Types.String; method: Types.String; args?: Array | null; @@ -176,72 +176,72 @@ interface Ethereum_Module_Args_callContractStatic { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getBalance { +export interface Ethereum_Module_Args_getBalance { address: Types.String; blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_encodeParams { +export interface Ethereum_Module_Args_encodeParams { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_encodeFunction { +export interface Ethereum_Module_Args_encodeFunction { method: Types.String; args?: Array | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_solidityPack { +export interface Ethereum_Module_Args_solidityPack { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_solidityKeccak256 { +export interface Ethereum_Module_Args_solidityKeccak256 { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_soliditySha256 { +export interface Ethereum_Module_Args_soliditySha256 { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerAddress { +export interface Ethereum_Module_Args_getSignerAddress { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerBalance { +export interface Ethereum_Module_Args_getSignerBalance { blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerTransactionCount { +export interface Ethereum_Module_Args_getSignerTransactionCount { blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getGasPrice { +export interface Ethereum_Module_Args_getGasPrice { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_estimateTransactionGas { +export interface Ethereum_Module_Args_estimateTransactionGas { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_estimateContractCallGas { +export interface Ethereum_Module_Args_estimateContractCallGas { address: Types.String; method: Types.String; args?: Array | null; @@ -250,22 +250,22 @@ interface Ethereum_Module_Args_estimateContractCallGas { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_checkAddress { +export interface Ethereum_Module_Args_checkAddress { address: Types.String; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_toWei { +export interface Ethereum_Module_Args_toWei { eth: Types.String; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_toEth { +export interface Ethereum_Module_Args_toEth { wei: Types.BigInt; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_awaitTransaction { +export interface Ethereum_Module_Args_awaitTransaction { txHash: Types.String; confirmations: Types.UInt32; timeout: Types.UInt32; @@ -273,7 +273,7 @@ interface Ethereum_Module_Args_awaitTransaction { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_waitForEvent { +export interface Ethereum_Module_Args_waitForEvent { address: Types.String; event: Types.String; args?: Array | null; @@ -282,17 +282,17 @@ interface Ethereum_Module_Args_waitForEvent { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getNetwork { +export interface Ethereum_Module_Args_getNetwork { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_requestAccounts { +export interface Ethereum_Module_Args_requestAccounts { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractMethod { +export interface Ethereum_Module_Args_callContractMethod { address: Types.String; method: Types.String; args?: Array | null; @@ -301,7 +301,7 @@ interface Ethereum_Module_Args_callContractMethod { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractMethodAndWait { +export interface Ethereum_Module_Args_callContractMethodAndWait { address: Types.String; method: Types.String; args?: Array | null; @@ -310,19 +310,19 @@ interface Ethereum_Module_Args_callContractMethodAndWait { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendTransaction { +export interface Ethereum_Module_Args_sendTransaction { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendTransactionAndWait { +export interface Ethereum_Module_Args_sendTransactionAndWait { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_deployContract { +export interface Ethereum_Module_Args_deployContract { abi: Types.String; bytecode: Types.String; args?: Array | null; @@ -330,19 +330,19 @@ interface Ethereum_Module_Args_deployContract { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_signMessage { +export interface Ethereum_Module_Args_signMessage { message: Types.String; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_signMessageBytes { +export interface Ethereum_Module_Args_signMessageBytes { bytes: Types.Bytes; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendRPC { +export interface Ethereum_Module_Args_sendRPC { method: Types.String; params: Array; connection?: Types.Ethereum_Connection | null; diff --git a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/module.ts b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/module.ts index d08b1a1fda..8a1f0fd9f1 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/module.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/module.ts @@ -1,8 +1,10 @@ /// NOTE: This is an auto-generated file. /// All modifications will be overwritten. +// @ts-ignore import * as Types from "./types"; +// @ts-ignore import { CoreClient, MaybeAsync } from "@polywrap/core-js"; import { PluginModule } from "@polywrap/plugin-js"; diff --git a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/types.ts b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/types.ts index 229d451eb9..aeaaa9db29 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/types.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/types.ts @@ -159,7 +159,7 @@ export interface Ethereum_Access { /// Imported Modules START /// /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractView { +export interface Ethereum_Module_Args_callContractView { address: Types.String; method: Types.String; args?: Array | null; @@ -167,7 +167,7 @@ interface Ethereum_Module_Args_callContractView { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractStatic { +export interface Ethereum_Module_Args_callContractStatic { address: Types.String; method: Types.String; args?: Array | null; @@ -176,72 +176,72 @@ interface Ethereum_Module_Args_callContractStatic { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getBalance { +export interface Ethereum_Module_Args_getBalance { address: Types.String; blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_encodeParams { +export interface Ethereum_Module_Args_encodeParams { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_encodeFunction { +export interface Ethereum_Module_Args_encodeFunction { method: Types.String; args?: Array | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_solidityPack { +export interface Ethereum_Module_Args_solidityPack { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_solidityKeccak256 { +export interface Ethereum_Module_Args_solidityKeccak256 { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_soliditySha256 { +export interface Ethereum_Module_Args_soliditySha256 { types: Array; values: Array; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerAddress { +export interface Ethereum_Module_Args_getSignerAddress { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerBalance { +export interface Ethereum_Module_Args_getSignerBalance { blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getSignerTransactionCount { +export interface Ethereum_Module_Args_getSignerTransactionCount { blockTag?: Types.BigInt | null; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getGasPrice { +export interface Ethereum_Module_Args_getGasPrice { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_estimateTransactionGas { +export interface Ethereum_Module_Args_estimateTransactionGas { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_estimateContractCallGas { +export interface Ethereum_Module_Args_estimateContractCallGas { address: Types.String; method: Types.String; args?: Array | null; @@ -250,22 +250,22 @@ interface Ethereum_Module_Args_estimateContractCallGas { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_checkAddress { +export interface Ethereum_Module_Args_checkAddress { address: Types.String; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_toWei { +export interface Ethereum_Module_Args_toWei { eth: Types.String; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_toEth { +export interface Ethereum_Module_Args_toEth { wei: Types.BigInt; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_awaitTransaction { +export interface Ethereum_Module_Args_awaitTransaction { txHash: Types.String; confirmations: Types.UInt32; timeout: Types.UInt32; @@ -273,7 +273,7 @@ interface Ethereum_Module_Args_awaitTransaction { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_waitForEvent { +export interface Ethereum_Module_Args_waitForEvent { address: Types.String; event: Types.String; args?: Array | null; @@ -282,17 +282,17 @@ interface Ethereum_Module_Args_waitForEvent { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_getNetwork { +export interface Ethereum_Module_Args_getNetwork { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_requestAccounts { +export interface Ethereum_Module_Args_requestAccounts { connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractMethod { +export interface Ethereum_Module_Args_callContractMethod { address: Types.String; method: Types.String; args?: Array | null; @@ -301,7 +301,7 @@ interface Ethereum_Module_Args_callContractMethod { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_callContractMethodAndWait { +export interface Ethereum_Module_Args_callContractMethodAndWait { address: Types.String; method: Types.String; args?: Array | null; @@ -310,19 +310,19 @@ interface Ethereum_Module_Args_callContractMethodAndWait { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendTransaction { +export interface Ethereum_Module_Args_sendTransaction { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendTransactionAndWait { +export interface Ethereum_Module_Args_sendTransactionAndWait { tx: Types.Ethereum_TxRequest; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_deployContract { +export interface Ethereum_Module_Args_deployContract { abi: Types.String; bytecode: Types.String; args?: Array | null; @@ -330,19 +330,19 @@ interface Ethereum_Module_Args_deployContract { } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_signMessage { +export interface Ethereum_Module_Args_signMessage { message: Types.String; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_signMessageBytes { +export interface Ethereum_Module_Args_signMessageBytes { bytes: Types.Bytes; connection?: Types.Ethereum_Connection | null; } /* URI: "ens/ethereum.polywrap.eth" */ -interface Ethereum_Module_Args_sendRPC { +export interface Ethereum_Module_Args_sendRPC { method: Types.String; params: Array; connection?: Types.Ethereum_Connection | null; From 9d83797f11b44947b7a09683a86e3c770306df7c Mon Sep 17 00:00:00 2001 From: krisbitney Date: Tue, 13 Dec 2022 11:26:50 +0530 Subject: [PATCH 2/2] added "// @ts-ignore" to module.ts in plugin codegen env test cases to match bindings update --- .../cases/cli/plugin/codegen/003-env/expected/wrap/module.ts | 2 ++ .../plugin/codegen/004-env-sanitization/expected/wrap/module.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/module.ts b/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/module.ts index 437a2407c2..1b4fbba3ba 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/module.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/module.ts @@ -1,8 +1,10 @@ /// NOTE: This is an auto-generated file. /// All modifications will be overwritten. +// @ts-ignore import * as Types from "./types"; +// @ts-ignore import { CoreClient, MaybeAsync } from "@polywrap/core-js"; import { PluginModule } from "@polywrap/plugin-js"; diff --git a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/module.ts b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/module.ts index 437a2407c2..1b4fbba3ba 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/module.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/module.ts @@ -1,8 +1,10 @@ /// NOTE: This is an auto-generated file. /// All modifications will be overwritten. +// @ts-ignore import * as Types from "./types"; +// @ts-ignore import { CoreClient, MaybeAsync } from "@polywrap/core-js"; import { PluginModule } from "@polywrap/plugin-js";