|
1 |
| - |
| 1 | + |
2 | 2 |
|
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 |
4 | 4 |
|
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. |
40 | 6 |
|
41 | 7 | ## Installation
|
42 |
| - |
43 |
| -To ensure all of your project's dependencies are installed, from inside your project's directory, simply run: |
44 |
| - |
45 | 8 | ```
|
46 |
| -nvm install && nvm use |
47 |
| -yarn |
| 9 | +npm install @polywrap/client |
| 10 | +# or |
| 11 | +yarn add @polywrap/client |
48 | 12 | ```
|
49 | 13 |
|
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 |
63 | 15 |
|
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. |
65 | 17 |
|
66 |
| -To lint your project directory, run the following: |
| 18 | +```typescript |
| 19 | +import { |
| 20 | + PolywrapClient, |
| 21 | + PolywrapClientConfigBuilder |
| 22 | +} from "@polywrap/client"; |
67 | 23 |
|
68 |
| -``` |
69 |
| -yarn lint |
70 |
| -``` |
| 24 | +const builder = new PolywrapClientConfigBuilder(); |
| 25 | +builder.addBundle("sys"); |
| 26 | +const client = new PolywrapClient(builder.build()); |
71 | 27 |
|
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 | +}); |
73 | 35 |
|
| 36 | +if (!result.ok) { |
| 37 | + throw Error("Log message error: " + result.error); |
| 38 | +} |
74 | 39 | ```
|
75 |
| -yarn lint:fix |
76 |
| -``` |
77 |
| - |
78 | 40 | # Resources
|
79 |
| -- [Website](https://polywrap.io/) |
| 41 | + |
80 | 42 | - [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 |
82 | 47 |
|
| 48 | +For any questions or problems, please visit our [Discord](https://discord.polywrap.io). |
0 commit comments