-
Notifications
You must be signed in to change notification settings - Fork 49
Feat: Client validate method #1340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
665a090
feat: start .validate function on client
cbrzn 3a74fce
chore: start tests of validate function
cbrzn b613eb6
feat: implemented abi validation & start exhaustive testing in valida…
cbrzn 09d4d78
chore: recursive tests implemented
cbrzn e21b830
feat: abis are compared if flag is passed
cbrzn 0692dd3
chore: house cleaning a bit
cbrzn 3b908f2
chore: abi validation test implemented
cbrzn d1b087e
chore: fix typos on comments
cbrzn 6a1b7f2
chore: client validate mvp finished
cbrzn 5bc179d
chore: removed test environment from test & use getManifest from wrap…
cbrzn 8335c12
chore: move compare function outside of formats & return multiple uri…
cbrzn 6a71e89
chore: remove local lint changes from test file
cbrzn c9dfe6d
chore: remove unused deploy manifest from test case & clean up wrap m…
cbrzn 80b49fd
chore: merge conflicts & fix client validate test
cbrzn d0ad8fe
chore: fix lint
cbrzn 07bcb1d
merge origin-dev
dOrgJelli c1fc4e5
Merge branch 'origin-dev' into feat/client-validate
cbrzn 32b60e7
chore: use static resolver on validate tests & update with latest cha…
cbrzn 240cf20
Merge branch 'origin-dev' into feat/client-validate
cbrzn 7d64be3
Merge branch 'feat/client-validate' of github.com:polywrap/toolchain …
cbrzn cb24354
chore(client): compareSignature now expects an object instead of a ty…
cbrzn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/js/client/src/__tests__/utils/validate/wrapper-a/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "name": "wrapper-a", | ||
| "private": true, | ||
| "dependencies": { | ||
| "@polywrap/wasm-as": "0.9.2", | ||
| "assemblyscript": "0.19.23" | ||
| } | ||
| } | ||
7 changes: 7 additions & 0 deletions
7
packages/js/client/src/__tests__/utils/validate/wrapper-a/polywrap.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| format: 0.2.0 | ||
| project: | ||
| name: WrapperA | ||
| type: wasm/assemblyscript | ||
| source: | ||
| schema: ./schema.graphql | ||
| module: ./src/index.ts |
3 changes: 3 additions & 0 deletions
3
packages/js/client/src/__tests__/utils/validate/wrapper-a/schema.graphql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| type Module { | ||
| foo(bar: String!): String! | ||
| } |
7 changes: 7 additions & 0 deletions
7
packages/js/client/src/__tests__/utils/validate/wrapper-a/src/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { | ||
| Args_foo | ||
| } from "./wrap"; | ||
|
|
||
| export function foo(args: Args_foo): String { | ||
| return args.bar | ||
| } |
8 changes: 8 additions & 0 deletions
8
packages/js/client/src/__tests__/utils/validate/wrapper-b/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "name": "wrapper-b", | ||
| "private": true, | ||
| "dependencies": { | ||
| "@polywrap/wasm-as": "0.9.2", | ||
| "assemblyscript": "0.19.23" | ||
| } | ||
| } |
10 changes: 10 additions & 0 deletions
10
packages/js/client/src/__tests__/utils/validate/wrapper-b/polywrap.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| format: 0.2.0 | ||
| project: | ||
| name: WrapperB | ||
| type: wasm/assemblyscript | ||
| source: | ||
| schema: ./schema.graphql | ||
| module: ./src/index.ts | ||
| import_abis: | ||
| - uri: "ens/foo.eth" | ||
| abi: "../wrapper-a/build/wrap.info" |
5 changes: 5 additions & 0 deletions
5
packages/js/client/src/__tests__/utils/validate/wrapper-b/schema.graphql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #import { Module } into Foo from "ens/foo.eth" | ||
|
|
||
| type Module { | ||
| greeting(message: String!): String! | ||
| } |
8 changes: 8 additions & 0 deletions
8
packages/js/client/src/__tests__/utils/validate/wrapper-b/src/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { | ||
| Args_greeting, | ||
| Foo_Module | ||
| } from "./wrap"; | ||
|
|
||
| export function greeting(args: Args_greeting): String { | ||
| return Foo_Module.foo({ bar: args.message }).unwrap(); | ||
| } |
8 changes: 8 additions & 0 deletions
8
packages/js/client/src/__tests__/utils/validate/wrapper-c/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "name": "wrapper-c", | ||
| "private": true, | ||
| "dependencies": { | ||
| "@polywrap/wasm-as": "0.9.2", | ||
| "assemblyscript": "0.19.23" | ||
| } | ||
| } |
7 changes: 7 additions & 0 deletions
7
packages/js/client/src/__tests__/utils/validate/wrapper-c/polywrap.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| format: 0.2.0 | ||
| project: | ||
| name: WrapperC | ||
| type: wasm/assemblyscript | ||
| source: | ||
| schema: ./schema.graphql | ||
| module: ./src/index.ts |
3 changes: 3 additions & 0 deletions
3
packages/js/client/src/__tests__/utils/validate/wrapper-c/schema.graphql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| type Module { | ||
| foo(bar: Int!): String! | ||
| } |
7 changes: 7 additions & 0 deletions
7
packages/js/client/src/__tests__/utils/validate/wrapper-c/src/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { | ||
| Args_foo | ||
| } from "./wrap"; | ||
|
|
||
| export function foo(args: Args_foo): String { | ||
| return args.bar.toString() | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { | ||
| MethodDefinition, PropertyDefinition, | ||
| } from "."; | ||
|
|
||
| export default ( | ||
| importedMethod: MethodDefinition, | ||
| expectedMethod: MethodDefinition | ||
| ): boolean => { | ||
| if (expectedMethod.name === importedMethod.name) { | ||
| return false | ||
| } | ||
|
|
||
| if (expectedMethod.arguments) { | ||
| const expectedArgs = expectedMethod.arguments.some(({type, name}, index) => { | ||
| const importedArgs = importedMethod.arguments as PropertyDefinition[] | ||
| const { name: importedName, type: importedType } = importedArgs[index] | ||
| return importedName === name && importedType === type | ||
| }) | ||
|
|
||
| if (!expectedArgs) { | ||
| return false | ||
| } | ||
| } | ||
| return true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.