Skip to content
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

Common Bundle - use Wrapscan URIs #62

Merged
merged 16 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions .github/workflows/ci-javascript.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,8 @@ jobs:
- name: Build docs
run: yarn build:docs

CI-WRAP-Test-Harness:
uses: ./.github/workflows/ci-wrap-test-harness.yaml

Test:
runs-on: ubuntu-latest
needs: CI-WRAP-Test-Harness
timeout-minutes: 60
if: ${{ always() }}
steps:
Expand Down Expand Up @@ -118,18 +114,5 @@ jobs:
- name: Build
run: yarn build

- name: Get updated wrappers
if: ${{ needs.CI-WRAP-Test-Harness.outputs.rebuild_required == 'true' }}
uses: actions/download-artifact@v3
id: get-wrappers
with:
name: rebuilt-wrappers
path: ./wrappers

- if: ${{ needs.CI-WRAP-Test-Harness.outputs.rebuild_required == 'true' }}
run: |
rm -rf packages/test-cases/wrappers
mv wrappers packages/test-cases

- name: Test
run: yarn test
118 changes: 0 additions & 118 deletions .github/workflows/ci-wrap-test-harness.yaml

This file was deleted.

1 change: 0 additions & 1 deletion WRAP_TEST_HARNESS

This file was deleted.

4 changes: 2 additions & 2 deletions integration-tests/react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@polywrap/client-js": "~0.10.1",
"@polywrap/sys-config-bundle-js": "~0.10.1",
"@polywrap/client-js": "~0.12.0-pre.1",
"@polywrap/sys-config-bundle-js": "~0.12.0-pre.1",
"@types/react": "^18.2.13",
"@types/react-dom": "^18.2.6",
"react": "^18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Invoke a wrapper.

```ts
const result = await client.invoke({
uri: "ens/helloworld.dev.polywrap.eth",
method: "logMessage",
uri: "wrapscan.io/polywrap/logging@1",
method: "info",
args: {
message: "Hello World!"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/client/examples/quickstart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export async function invoke(): Promise<any> {
const client = new PolywrapClient();
// $start: quickstart-invoke
const result = await client.invoke({
uri: "ens/helloworld.dev.polywrap.eth",
method: "logMessage",
uri: "wrapscan.io/polywrap/logging@1",
method: "info",
args: {
message: "Hello World!"
}
Expand Down
2 changes: 0 additions & 2 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"@polywrap/wrap-manifest-types-js": "0.12.0-pre.1"
},
"devDependencies": {
"@polywrap/cli-js": "~0.10.0",
"@polywrap/sys-config-bundle-js": "0.12.0-pre.1",
"@polywrap/test-cases": "0.12.0-pre.1",
"@types/jest": "29.5.0",
Expand All @@ -44,7 +43,6 @@
"bignumber.js": "9.0.2",
"doc-snippets": "~1.0.0",
"jest": "29.5.0",
"polywrap": "~0.10.0",
"rimraf": "3.0.2",
"ts-jest": "29.1.0",
"ts-loader": "8.0.17",
Expand Down
22 changes: 11 additions & 11 deletions packages/client/src/__tests__/core/error-structure.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ describe("Error structure", () => {
expect(result.error?.innerError instanceof WrapError).toBeTruthy();
const prev = result.error?.innerError as WrapError;
expect(prev.name).toEqual("WrapError");
expect(prev.code).toEqual(WrapErrorCode.WRAPPER_INVOKE_ABORTED);
expect(prev.code).toEqual(WrapErrorCode.URI_NOT_FOUND);
expect(prev.reason).toContain(
"A URI Resolver returned an error."
"Unable to find URI wrap://authority/imported-invoke"
);
expect(prev.uri).toEqual("wrap://ens/wraps.eth:ens-uri-resolver-ext@1.0.1");
expect(prev.uri).toEqual("wrap://authority/imported-invoke");
});

describe("Wasm wrapper - Assemblyscript", () => {
Expand Down Expand Up @@ -165,8 +165,8 @@ describe("Error structure", () => {
const config = new PolywrapClientConfigBuilder()
.addDefaults()
.setRedirects({
"ens/imported-invoke.eth": asInvokeWrapperUri.uri,
"ens/imported-subinvoke.eth": asSubinvokeWrapperUri.uri,
"authority/imported-invoke": asInvokeWrapperUri.uri,
"authority/imported-subinvoke": asSubinvokeWrapperUri.uri,
})
.build();
const client = new PolywrapClient(config);
Expand Down Expand Up @@ -206,7 +206,7 @@ describe("Error structure", () => {
expect(
prev.reason.startsWith("SubInvocation exception encountered")
).toBeTruthy();
expect(prev.uri).toEqual("wrap://ens/imported-invoke.eth");
expect(prev.uri).toEqual("wrap://authority/imported-invoke");
expect(prev.method).toEqual("invokeThrowError");
expect(prev.args).toEqual('{\n "a": "Hey"\n}' );
expect(prev.source?.file).toEqual(
Expand All @@ -219,7 +219,7 @@ describe("Error structure", () => {
expect(prevOfPrev.code).toEqual(WrapErrorCode.WRAPPER_INVOKE_ABORTED);
expect(prevOfPrev.reason).toEqual("__wrap_abort: Hey");
expect(
prevOfPrev.uri.endsWith("wrap://ens/imported-subinvoke.eth")
prevOfPrev.uri.endsWith("wrap://authority/imported-subinvoke")
).toBeTruthy();
expect(prevOfPrev.method).toEqual("subinvokeThrowError");
expect(prev.args).toEqual('{\n "a": "Hey"\n}');
Expand Down Expand Up @@ -341,8 +341,8 @@ describe("Error structure", () => {
const config = new PolywrapClientConfigBuilder()
.addDefaults()
.setRedirects({
"ens/imported-invoke.eth": rsInvokeWrapperUri.uri,
"ens/imported-subinvoke.eth": rsSubinvokeWrapperUri.uri,
"authority/imported-invoke": rsInvokeWrapperUri.uri,
"authority/imported-subinvoke": rsSubinvokeWrapperUri.uri,
})
.build();

Expand Down Expand Up @@ -381,7 +381,7 @@ describe("Error structure", () => {
expect(
prev.reason.startsWith("SubInvocation exception encountered")
).toBeTruthy();
expect(prev.uri).toEqual("wrap://ens/imported-invoke.eth");
expect(prev.uri).toEqual("wrap://authority/imported-invoke");
expect(prev.method).toEqual("invokeThrowError");
expect(prev.args).toEqual('{\n "a": "Hey"\n}');
expect(prev.source?.file).toEqual("src/lib.rs");
Expand All @@ -392,7 +392,7 @@ describe("Error structure", () => {
expect(prevOfPrev.code).toEqual(WrapErrorCode.WRAPPER_INVOKE_ABORTED);
expect(prevOfPrev.reason).toEqual("__wrap_abort: Hey");
expect(
prevOfPrev.uri.endsWith("wrap://ens/imported-subinvoke.eth")
prevOfPrev.uri.endsWith("wrap://authority/imported-subinvoke")
).toBeTruthy();
expect(prevOfPrev.method).toEqual("subinvokeThrowError");
expect(prevOfPrev.args).toEqual('{\n "a": "Hey"\n}');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("plugin-wrapper", () => {
};

test("plugin map types", async () => {
const implementationUri = Uri.from("wrap://ens/some-implementation.eth");
const implementationUri = Uri.from("wrap://authority/some-implementation");
const mockPlugin = mockMapPlugin();
const client = new PolywrapClient({
resolver: UriResolver.from([
Expand Down
6 changes: 3 additions & 3 deletions packages/client/src/__tests__/core/sanity.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ describe("sanity", () => {
});

test("validate requested uri is available", async () => {
const subinvokeUri = Uri.from("ens/imported-subinvoke.eth");
const invokeUri = Uri.from("ens/imported-invoke.eth");
const consumerUri = Uri.from("ens/consumer.eth");
const subinvokeUri = Uri.from("authority/imported-subinvoke");
const invokeUri = Uri.from("authority/imported-invoke");
const consumerUri = Uri.from("authority/consumer");

const getPackage = async (name: string) => {
const manifest = await fs.promises.readFile(
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/__tests__/core/type-test-cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const typeTestCases = (implementation: string) => {
const config = new PolywrapClientConfigBuilder()
.addDefaults()
.setPackage(
"wrap://ens/memory-storage.polywrap.eth",
"wrap://plugin/memory-storage",
memoryStoragePlugin()
)
.build();
Expand Down
8 changes: 4 additions & 4 deletions packages/client/src/__tests__/core/uri-resolution.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ const expectResolutionResult = async (

describe("URI resolution", () => {
it("sanity", async () => {
const uri = new Uri("ens/wraps.eth:uri-resolver-ext@1.1.0");
const uri = new Uri("wrapscan.io/polywrap/uri-resolver@1.0.0");

const client = new PolywrapClient();

const resolutionContext = new UriResolutionContext();
const result = await client.tryResolveUri({ uri, resolutionContext });

const expectResult = UriResolutionResult.ok(
Uri.from("wrap://ipfs/QmSAXrSLcmGUkQRrApAtG5qTPmuRMMX2Zf1wihpguDQfbm")
Uri.from("wrap://ipfs/QmeHyySwhkYvKqaPNtcq7wYDb1M9QnaqbaX1eDNDqW5fdt")
);

if (expectResult.ok) {
Expand All @@ -51,8 +51,8 @@ describe("URI resolution", () => {
});

it("can resolve uri with custom resolver", async () => {
const fromUri = new Uri(`test/from.eth`);
const redirectUri = new Uri(`test/to.eth`);
const fromUri = new Uri(`test/from`);
const redirectUri = new Uri(`test/to`);

const config = new PolywrapClientConfigBuilder()
.addDefaults()
Expand Down
12 changes: 6 additions & 6 deletions packages/client/src/__tests__/core/wasm-wrapper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ describe("wasm-wrapper", () => {
it("should invoke wrapper with custom redirects", async () => {
const config = new PolywrapClientConfigBuilder()
.addDefaults()
.setRedirect(wrapperUri.uri, "wrap://ens/mock.polywrap.eth")
.setPackage("wrap://ens/mock.polywrap.eth", mockPlugin())
.setRedirect(wrapperUri.uri, "wrap://authority/mock.polywrap")
.setPackage("wrap://authority/mock.polywrap", mockPlugin())
.build();
const client = new PolywrapClient(config);

Expand All @@ -104,7 +104,7 @@ describe("wasm-wrapper", () => {
it("should allow clone + reconfigure of redirects", async () => {
let builder = new PolywrapClientConfigBuilder()
.add({
packages: { "wrap://ens/mock.polywrap.eth": mockPlugin() },
packages: { "wrap://authority/mock.polywrap": mockPlugin() },
})
.addDefaults();

Expand All @@ -122,7 +122,7 @@ describe("wasm-wrapper", () => {
expect(clientResult).toEqual(ResultOk(2));

const redirects = {
[wrapperUri.uri]: "wrap://ens/mock.polywrap.eth",
[wrapperUri.uri]: "wrap://authority/mock.polywrap",
};

builder = builder.add({ redirects });
Expand Down Expand Up @@ -164,12 +164,12 @@ describe("wasm-wrapper", () => {

const pluginClient = new PolywrapClient({
resolver: UriResolver.from([
mockPluginRegistration("ens/mock-plugin.eth"),
mockPluginRegistration("authority/mock-plugin"),
]),
});

let pluginGetFileResult = await pluginClient.getFile(
"ens/mock-plugin.eth",
"authority/mock-plugin",
{
path: "./index.js",
}
Expand Down
Loading
Loading