From c0e3106a4af8f07974524f902b4b23624b6a1da0 Mon Sep 17 00:00:00 2001 From: Pileks Date: Wed, 2 Nov 2022 21:20:47 +0100 Subject: [PATCH 1/4] CLI Build - clean up `yarn.lock` files in test cases after testing local build strategy --- packages/cli/src/__tests__/e2e/build.spec.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/cli/src/__tests__/e2e/build.spec.ts b/packages/cli/src/__tests__/e2e/build.spec.ts index 24275ff75e..48b5b00be9 100644 --- a/packages/cli/src/__tests__/e2e/build.spec.ts +++ b/packages/cli/src/__tests__/e2e/build.spec.ts @@ -229,6 +229,26 @@ describe("e2e tests for build command", () => { }) describe("Local strategy", () => { + + // Local strategy runs `yarn` by default, so we need to ensure that we clean up lockfiles + beforeAll(async () => { + for (let i = 0; i < testCases.length; i++) { + const yarnLockfile = path.join(getTestCaseDir(0), "yarn.lock"); + if(fs.existsSync(yarnLockfile)){ + await fs.promises.unlink(yarnLockfile); + } + } + }); + + afterAll(async () => { + for (let i = 0; i < testCases.length; i++) { + const yarnLockfile = path.join(getTestCaseDir(0), "yarn.lock"); + if(fs.existsSync(yarnLockfile)){ + await fs.promises.unlink(yarnLockfile); + } + } + }); + it("Builds for assemblyscript", async () => { const { exitCode: code, stdout: output } = await runCLI({ args: ["build", "-v", "-s", "local"], From 5c5de216279d8cacbc14267c8421ed2354a6da5a Mon Sep 17 00:00:00 2001 From: Pileks Date: Wed, 2 Nov 2022 21:22:52 +0100 Subject: [PATCH 2/4] minor refactor --- packages/cli/src/__tests__/e2e/build.spec.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/cli/src/__tests__/e2e/build.spec.ts b/packages/cli/src/__tests__/e2e/build.spec.ts index 48b5b00be9..039f9eadd5 100644 --- a/packages/cli/src/__tests__/e2e/build.spec.ts +++ b/packages/cli/src/__tests__/e2e/build.spec.ts @@ -231,22 +231,21 @@ describe("e2e tests for build command", () => { describe("Local strategy", () => { // Local strategy runs `yarn` by default, so we need to ensure that we clean up lockfiles - beforeAll(async () => { + const cleanupYarnLockfiles = async () => { for (let i = 0; i < testCases.length; i++) { const yarnLockfile = path.join(getTestCaseDir(0), "yarn.lock"); if(fs.existsSync(yarnLockfile)){ await fs.promises.unlink(yarnLockfile); } } + }; + + beforeAll(async () => { + await cleanupYarnLockfiles(); }); afterAll(async () => { - for (let i = 0; i < testCases.length; i++) { - const yarnLockfile = path.join(getTestCaseDir(0), "yarn.lock"); - if(fs.existsSync(yarnLockfile)){ - await fs.promises.unlink(yarnLockfile); - } - } + await cleanupYarnLockfiles(); }); it("Builds for assemblyscript", async () => { From 8bacbd4c0a2fd9e8391c4ac12895429113d050f9 Mon Sep 17 00:00:00 2001 From: Pileks Date: Thu, 3 Nov 2022 14:40:24 +0100 Subject: [PATCH 3/4] Fix codegen test codegen/build artifacts to reflect updates in ethereum plugin --- .../expected/build-artifacts/wrap.info | Bin 22450 -> 22818 bytes .../codegen/001-sanity/expected/wrap/types.ts | 17 +++++++ .../001-sanity/expected/wrap/wrap.info.ts | 42 ++++++++++++++++++ .../expected/build-artifacts/wrap.info | Bin 22201 -> 22569 bytes .../002-single-module/expected/wrap/types.ts | 17 +++++++ .../expected/wrap/wrap.info.ts | 42 ++++++++++++++++++ .../expected/build-artifacts/wrap.info | Bin 22450 -> 22818 bytes .../005-custom-config/expected/wrap/types.ts | 17 +++++++ .../expected/wrap/wrap.info.ts | 42 ++++++++++++++++++ .../expected/build-artifacts/wrap.info | Bin 22450 -> 22818 bytes .../expected/wrap/types.ts | 17 +++++++ .../expected/wrap/wrap.info.ts | 42 ++++++++++++++++++ 12 files changed, 236 insertions(+) diff --git a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/build-artifacts/wrap.info b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/build-artifacts/wrap.info index d79a2831a29d5aac720faea92b7c534af49b7e69..d9822968b5114eef0142962a158a542707cbbc58 100644 GIT binary patch delta 140 zcmdnAo^jD8#tplb7-cu_QED&}*if9Ap68odT%4Gm>Qq^hI>|(uA5CboqnsQ+n!3ps z_2ec`Fjb%2pv5Mz6r{0uNnT=Z>e3`26Qn^9%qm_|Qdy7+k)NC>BsMu#J$bT#2is@n>2+{xm 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 e2cef98b68..229d451eb9 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 @@ -335,6 +335,12 @@ interface Ethereum_Module_Args_signMessage { connection?: Types.Ethereum_Connection | null; } +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_signMessageBytes { + bytes: Types.Bytes; + connection?: Types.Ethereum_Connection | null; +} + /* URI: "ens/ethereum.polywrap.eth" */ interface Ethereum_Module_Args_sendRPC { method: Types.String; @@ -641,6 +647,17 @@ export const Ethereum_Module = { }); }, + signMessageBytes: async ( + args: Ethereum_Module_Args_signMessageBytes, + client: CoreClient + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "signMessageBytes", + args: (args as unknown) as Record, + }); + }, + sendRPC: async ( args: Ethereum_Module_Args_sendRPC, client: CoreClient diff --git a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/wrap.info.ts b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/wrap.info.ts index 80f300e7ad..4c71f66887 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/wrap.info.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/wrap.info.ts @@ -1532,6 +1532,48 @@ export const manifest: WrapManifest = { }, "type": "Method" }, + { + "arguments": [ + { + "kind": 34, + "name": "bytes", + "required": true, + "scalar": { + "kind": 4, + "name": "bytes", + "required": true, + "type": "Bytes" + }, + "type": "Bytes" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "signMessageBytes", + "required": true, + "return": { + "kind": 34, + "name": "signMessageBytes", + "required": true, + "scalar": { + "kind": 4, + "name": "signMessageBytes", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, { "arguments": [ { diff --git a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/build-artifacts/wrap.info b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/build-artifacts/wrap.info index 26683c026cf6c94c7e581bc3ab7fb2063e776bd9..39ef9d47a560421c312f7ee4b9901f1444c8bbaa 100644 GIT binary patch delta 140 zcmdnFmT~0<#tnxQnPl50zf%<3d`mIYNN_`OW_q4)YH@L5da6@pNow)rwK|dl=%SMi zjpg~#R8DqOlbxKPsVlG)tZzwPVs7fvB%l#M#d3mRR`HUO%7Rpg{Nx5%vB_tZGdDYj HlraGSVLLZz delta 26 icmZ3vfpO> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "signMessageBytes", + args: (args as unknown) as Record, + }); + }, + sendRPC: async ( args: Ethereum_Module_Args_sendRPC, client: CoreClient diff --git a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/wrap.info.ts b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/wrap.info.ts index e042ae0328..9db77b53a2 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/wrap.info.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/wrap.info.ts @@ -1532,6 +1532,48 @@ export const manifest: WrapManifest = { }, "type": "Method" }, + { + "arguments": [ + { + "kind": 34, + "name": "bytes", + "required": true, + "scalar": { + "kind": 4, + "name": "bytes", + "required": true, + "type": "Bytes" + }, + "type": "Bytes" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "signMessageBytes", + "required": true, + "return": { + "kind": 34, + "name": "signMessageBytes", + "required": true, + "scalar": { + "kind": 4, + "name": "signMessageBytes", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, { "arguments": [ { diff --git a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/build-artifacts/wrap.info b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/build-artifacts/wrap.info index d79a2831a29d5aac720faea92b7c534af49b7e69..d9822968b5114eef0142962a158a542707cbbc58 100644 GIT binary patch delta 140 zcmdnAo^jD8#tplb7-cu_QED&}*if9Ap68odT%4Gm>Qq^hI>|(uA5CboqnsQ+n!3ps z_2ec`Fjb%2pv5Mz6r{0uNnT=Z>e3`26Qn^9%qm_|Qdy7+k)NC>BsMu#J$bT#2is@n>2+{xm 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 e2cef98b68..229d451eb9 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 @@ -335,6 +335,12 @@ interface Ethereum_Module_Args_signMessage { connection?: Types.Ethereum_Connection | null; } +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_signMessageBytes { + bytes: Types.Bytes; + connection?: Types.Ethereum_Connection | null; +} + /* URI: "ens/ethereum.polywrap.eth" */ interface Ethereum_Module_Args_sendRPC { method: Types.String; @@ -641,6 +647,17 @@ export const Ethereum_Module = { }); }, + signMessageBytes: async ( + args: Ethereum_Module_Args_signMessageBytes, + client: CoreClient + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "signMessageBytes", + args: (args as unknown) as Record, + }); + }, + sendRPC: async ( args: Ethereum_Module_Args_sendRPC, client: CoreClient diff --git a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/wrap.info.ts b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/wrap.info.ts index 80f300e7ad..4c71f66887 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/wrap.info.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/wrap.info.ts @@ -1532,6 +1532,48 @@ export const manifest: WrapManifest = { }, "type": "Method" }, + { + "arguments": [ + { + "kind": 34, + "name": "bytes", + "required": true, + "scalar": { + "kind": 4, + "name": "bytes", + "required": true, + "type": "Bytes" + }, + "type": "Bytes" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "signMessageBytes", + "required": true, + "return": { + "kind": 34, + "name": "signMessageBytes", + "required": true, + "scalar": { + "kind": 4, + "name": "signMessageBytes", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, { "arguments": [ { diff --git a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/build-artifacts/wrap.info b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/build-artifacts/wrap.info index d79a2831a29d5aac720faea92b7c534af49b7e69..d9822968b5114eef0142962a158a542707cbbc58 100644 GIT binary patch delta 140 zcmdnAo^jD8#tplb7-cu_QED&}*if9Ap68odT%4Gm>Qq^hI>|(uA5CboqnsQ+n!3ps z_2ec`Fjb%2pv5Mz6r{0uNnT=Z>e3`26Qn^9%qm_|Qdy7+k)NC>BsMu#J$bT#2is@n>2+{xm 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 e2cef98b68..229d451eb9 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 @@ -335,6 +335,12 @@ interface Ethereum_Module_Args_signMessage { connection?: Types.Ethereum_Connection | null; } +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_signMessageBytes { + bytes: Types.Bytes; + connection?: Types.Ethereum_Connection | null; +} + /* URI: "ens/ethereum.polywrap.eth" */ interface Ethereum_Module_Args_sendRPC { method: Types.String; @@ -641,6 +647,17 @@ export const Ethereum_Module = { }); }, + signMessageBytes: async ( + args: Ethereum_Module_Args_signMessageBytes, + client: CoreClient + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "signMessageBytes", + args: (args as unknown) as Record, + }); + }, + sendRPC: async ( args: Ethereum_Module_Args_sendRPC, client: CoreClient diff --git a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/wrap.info.ts b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/wrap.info.ts index 80f300e7ad..4c71f66887 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/wrap.info.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/wrap.info.ts @@ -1532,6 +1532,48 @@ export const manifest: WrapManifest = { }, "type": "Method" }, + { + "arguments": [ + { + "kind": 34, + "name": "bytes", + "required": true, + "scalar": { + "kind": 4, + "name": "bytes", + "required": true, + "type": "Bytes" + }, + "type": "Bytes" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "signMessageBytes", + "required": true, + "return": { + "kind": 34, + "name": "signMessageBytes", + "required": true, + "scalar": { + "kind": 4, + "name": "signMessageBytes", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, { "arguments": [ { From de275f77eb0ed54bd5cb469c0f09567072008369 Mon Sep 17 00:00:00 2001 From: Pileks Date: Thu, 3 Nov 2022 16:20:49 +0100 Subject: [PATCH 4/4] CLI tests - fix expected docgen output for Ethereum plugin change --- .../cli/docgen/004-app/expected/docs/Ethereum_module.md | 9 +++++++++ .../009-schema/expected/docs/generated-schema.graphql | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/packages/test-cases/cases/cli/docgen/004-app/expected/docs/Ethereum_module.md b/packages/test-cases/cases/cli/docgen/004-app/expected/docs/Ethereum_module.md index 2981a95951..6d30b8541f 100644 --- a/packages/test-cases/cases/cli/docgen/004-app/expected/docs/Ethereum_module.md +++ b/packages/test-cases/cases/cli/docgen/004-app/expected/docs/Ethereum_module.md @@ -217,6 +217,15 @@ signMessage( ): String! ``` +### signMessageBytes + +```graphql +signMessageBytes( + bytes: Bytes! + connection: Ethereum_Connection +): String! +``` + ### solidityKeccak256 ```graphql diff --git a/packages/test-cases/cases/cli/docgen/009-schema/expected/docs/generated-schema.graphql b/packages/test-cases/cases/cli/docgen/009-schema/expected/docs/generated-schema.graphql index 7c591de829..f9f3507d37 100644 --- a/packages/test-cases/cases/cli/docgen/009-schema/expected/docs/generated-schema.graphql +++ b/packages/test-cases/cases/cli/docgen/009-schema/expected/docs/generated-schema.graphql @@ -250,6 +250,11 @@ type Ethereum_Module @imported( connection: Ethereum_Connection ): String! + signMessageBytes( + bytes: Bytes! + connection: Ethereum_Connection + ): String! + sendRPC( method: String! params: [String!]!