Skip to content

Commit 8218801

Browse files
authored
Merge pull request #70 from polywrap/origin-0.12-dev
Prep 0.12.1 | /workflows/release-pr
2 parents f31ccab + 8b816bc commit 8218801

34 files changed

+1176
-1612
lines changed

.github/workflows/ci-javascript.yaml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ jobs:
8383
Test:
8484
runs-on: ubuntu-latest
8585
timeout-minutes: 60
86-
if: ${{ always() }}
8786
steps:
8887
- name: Checkout repository
8988
uses: actions/checkout@v2
@@ -116,3 +115,50 @@ jobs:
116115

117116
- name: Test
118117
run: yarn test
118+
119+
Examples:
120+
runs-on: ubuntu-latest
121+
timeout-minutes: 60
122+
steps:
123+
- name: Checkout repository
124+
uses: actions/checkout@v2
125+
126+
- name: Read .nvmrc
127+
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
128+
id: nvm
129+
130+
- name: Setup Node.js
131+
uses: actions/setup-node@master
132+
with:
133+
node-version: '${{ steps.nvm.outputs.NVMRC }}'
134+
135+
- name: Get yarn cache directory path
136+
id: yarn-cache-dir-path
137+
run: echo "::set-output name=dir::$(yarn cache dir)"
138+
139+
- uses: actions/cache@v2
140+
with:
141+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
142+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
143+
restore-keys: |
144+
${{ runner.os }}-yarn-
145+
146+
- name: Install dependencies
147+
run: (yarn install --nonInteractive --frozen-lockfile --prefer-offline || yarn install --nonInteractive --frozen-lockfile --prefer-offline)
148+
149+
- name: Build
150+
run: yarn build
151+
152+
- name: Instantiate IPFS node
153+
run: npx polywrap infra up --modules=eth-ens-ipfs
154+
155+
- name: Examples
156+
run: |
157+
cd examples
158+
yarn
159+
yarn run:logger
160+
yarn run:fs
161+
yarn run:http
162+
yarn run:ipfs
163+
yarn run:ethereum
164+
yarn run:ens

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ polywrap.deployment.txt
2323
**/.pytest_cache/
2424
**/__pycache__/
2525
**/dist/
26-
poetry.lock
26+
poetry.lock
27+
examples/yarn.lock

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# Polywrap Origin (0.12.1)
2+
## Bugs
3+
**`@polywrap/wrap-manifest-types-js`:**
4+
* [PR-68](https://github.com/polywrap/javascript-client/pull/68) **Browser compilation fix**
5+
* The "semver" sub-dependency (version `7.5.0`) has a problem building for the browser, upgrading to `7.5.4` fixes this.
6+
* source: https://github.com/npm/node-semver/issues/554
7+
18
# Polywrap Origin (0.12.0)
29
## Features
310
**`@polywrap/sys-config-bundle-js`:**

CONTRIBUTING.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Contributing
2+
3+
Thank you for considering contributing to the Polywrap Javascript Client! We welcome contributions from the community to help improve and enhance the project. Look through this repository's [issues](https://github.com/polywrap/javascript-client/issues) to see what we're focused on solving.
4+
5+
6+
## Pre-Requisites
7+
To be able to fully build and test all functionality within the JS Client, you'll need the following programs installed:
8+
9+
`nvm`
10+
`yarn`
11+
12+
## Installation
13+
14+
From the root directory, run `nvm install && nvm use` to install the correct version of Node.JS. Next, run `yarn` to install all dependencies for all packages.
15+
16+
## Build
17+
18+
Running `yarn build` from the root directory will build all packages. After this, if you'd like to rebuild an individual package you're making changes to, simply run `yarn build` within the specific `./packages/...` folder you're working in.
19+
20+
21+
## Test
22+
23+
Run `yarn test` from the root to test everything, and `yarn test` within a specific package folder to test just that package.
24+
25+
26+
## Feedback and Discussions
27+
28+
For questions, suggestions, or discussions, open an issue or create a discussion within the [Polywrap Discord](https://discord.polywrap.io).
29+
30+
Happy coding!

DEV_GUIDELINES.md

Lines changed: 0 additions & 55 deletions
This file was deleted.

README.md

Lines changed: 32 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,48 @@
1-
![Public Release Announcement](https://user-images.githubusercontent.com/5522128/177473887-2689cf25-7937-4620-8ca5-17620729a65d.png)
1+
![polywrap-banner](https://raw.githubusercontent.com/polywrap/branding/master/assets/banner.png)
22

3-
[**Polywrap**](https://polywrap.io/) is a developer tool that enables easy integration of Web3 protocols into any application. It makes it possible for applications on any platform, written in any language, to read and write data to Web3 protocols.
3+
# Javascript Client
44

5-
# Getting Started
6-
7-
Have questions or want to get involved? Join our community [Discord](https://discord.polywrap.io) or [open an issue](https://github.com/polywrap/javascript-client/issues) on Github.
8-
9-
For detailed information about Polywrap and the WRAP standard, visit our [developer documentation](https://docs.polywrap.io/).
10-
11-
# Contributing
12-
13-
The Polywrap project is completely open-source and we welcome contributors of all levels.
14-
15-
Come visit our [Github issues](https://github.com/polywrap/javascript-client/issues) to see the problems we're focused on solving. Here are some of our tags for issues and what they mean:
16-
17-
- `good first issue` - These are good first issues for newcomers to learn about how our project works
18-
19-
- `pri-0`, `pri-1` and `pri-2` - These are our priority issues, with `pri-0` being our highest priority and `pri-2` being lower.
20-
21-
- `alpha-blocker` - We're in pre-alpha right now and to get to alpha, we need to resolve all alpha blocker issues
22-
23-
- `beta-blocker` - After our alpha release, we'll start working towards releasing our beta! These are the blockers for us in reaching that milestone.
24-
25-
Below are a series of steps to get started with our monorepo after you've cloned it into your local repository.
26-
27-
Before contributing to this repository, please read the [developer guidelines](DEV_GUIDELINES.md).
28-
29-
## Pre-reqs
30-
31-
You'll need the following installed before building your wrapper:
32-
33-
`nvm`
34-
35-
`yarn`
36-
37-
`docker`
38-
39-
`docker-compose`
5+
Implementation of the Polywrap client in JavaScript.
406

417
## Installation
42-
43-
To ensure all of your project's dependencies are installed, from inside your project's directory, simply run:
44-
458
```
46-
nvm install && nvm use
47-
yarn
9+
npm install @polywrap/client
10+
# or
11+
yarn add @polywrap/client
4812
```
4913

50-
## Build
51-
52-
Run the following to compile the monorepo:
53-
54-
`yarn build`
55-
56-
## Test
57-
58-
Run the following to test if the build worked:
59-
60-
```
61-
yarn test
62-
```
14+
## Getting Started
6315

64-
## Lint
16+
Create a new Polywrap client config builder instance, add the bundles you want to use, and then create a new Polywrap client instance with the config.
6517

66-
To lint your project directory, run the following:
18+
```typescript
19+
import {
20+
PolywrapClient,
21+
PolywrapClientConfigBuilder
22+
} from "@polywrap/client";
6723

68-
```
69-
yarn lint
70-
```
24+
const builder = new PolywrapClientConfigBuilder();
25+
builder.addBundle("sys");
26+
const client = new PolywrapClient(builder.build());
7127

72-
To auto-fix lint errors:
28+
const result = await client.invoke<boolean>({
29+
uri: "wrapscan.io/polywrap/[email protected]",
30+
method: "info",
31+
args: {
32+
message: "Hello from hello world wrap!",
33+
}
34+
});
7335

36+
if (!result.ok) {
37+
throw Error("Log message error: " + result.error);
38+
}
7439
```
75-
yarn lint:fix
76-
```
77-
7840
# Resources
79-
- [Website](https://polywrap.io/)
41+
8042
- [Documentation](https://docs.polywrap.io/)
81-
- [Forum](https://forum.polywrap.io/)
43+
- [Examples](./examples/)
44+
- [Features supported](https://github.com/polywrap/client-readiness/tree/main/clients/js/src/features)
45+
46+
# Support
8247

48+
For any questions or problems, please visit our [Discord](https://discord.polywrap.io).

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.12.0
1+
0.12.1

examples/README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Polywrap JS Client Examples
2+
3+
Before running any example you must run `yarn` in the `examples` folder
4+
5+
## File System
6+
7+
Invokes the File System plugin; which creates, reads and deletes a file
8+
```
9+
$ yarn run:fs
10+
```
11+
12+
## Http
13+
14+
Invokes the HTTP plugin, doing GET and POST requests
15+
```
16+
$ yarn run:http
17+
```
18+
19+
## Ipfs
20+
21+
Invoke the IPFS Client wrap; adds file to a local IPFS node, and then retrieves it.
22+
Before running this example, you must instantiate a local IPFS node by running the following command:
23+
24+
_NOTE: This command requires Docker to be installed on your machine._
25+
```
26+
$ npx polywrap infra up --modules=eth-ens-ipfs
27+
```
28+
And now you can run the example:
29+
```
30+
$ yarn run:ipfs
31+
```
32+
33+
## Logger
34+
35+
Invokes the logger wrap, which interacts with the logger plugin. It shows a console.log message from WASM world
36+
```
37+
$ yarn run:logger
38+
```
39+
40+
## Ethereum
41+
42+
Invoke the Ethers core & util wraps, and uses the Ethereum Wallet plugin. It gets the balance of the Staking contract and then parses it from Wei to Eth. Also, it executes the sign typed data method
43+
44+
```
45+
$ yarn run:ethereum
46+
```
47+
48+
## ENS
49+
50+
Invoke the ENS wrap, it gets the resolver & content hash of vitalik.eth
51+
```
52+
$ yarn run:ens
53+
```
54+
55+

examples/package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "polywrap-js-examples",
3+
"description": "Polywrap Client JS examples",
4+
"license": "MIT",
5+
"scripts": {
6+
"run:fs": "ts-node src/filesystem.ts",
7+
"run:http": "ts-node src/http.ts",
8+
"run:logger": "ts-node src/logger.ts",
9+
"run:ipfs": "ts-node src/ipfs.ts",
10+
"run:ethereum": "ts-node src/ethereum.ts",
11+
"run:ens": "ts-node src/ens.ts"
12+
},
13+
"devDependencies": {
14+
"@polywrap/client-js": "../packages/client",
15+
"@polywrap/file-system-plugin-js": "0.12.0",
16+
"@polywrap/http-plugin-js": "0.12.0",
17+
"@polywrap/logger-plugin-js": "0.12.0",
18+
"@polywrap/ethereum-wallet-js": "0.1.0",
19+
"ts-node": "10.9.1",
20+
"typescript": "4.9.5"
21+
},
22+
"publishConfig": {
23+
"access": "public"
24+
}
25+
}

0 commit comments

Comments
 (0)