Skip to content

Commit 7e1beda

Browse files
authored
Merge pull request #55 from polywrap/develop
Release 0.4.3
2 parents f497501 + f4be08d commit 7e1beda

55 files changed

Lines changed: 9206 additions & 114 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ members = [
2222
"examples/http-server-app",
2323
"examples/simple-storage-app",
2424
"examples/advanced-server-app",
25+
"examples/app-with-ui",
2526
]
2627

2728
default-members = [
@@ -40,6 +41,7 @@ default-members = [
4041
"examples/http-server-app",
4142
"examples/simple-storage-app",
4243
"examples/advanced-server-app",
44+
"examples/app-with-ui",
4345
]
4446

4547
[workspace.dependencies]

README.md

Lines changed: 3 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -20,63 +20,9 @@ Then, to install `pwr`, run:
2020
```bash
2121
pwrup
2222
```
23-
## Script WRAPS (JS and Python)
24-
{lang} = js | py
2523

26-
### REPL
27-
`pwr {lang} repl`
28-
Runs a REPL where you can type scripts.
29-
30-
`pwr {lang} repl -f {name_of_file}`
31-
Runs the repl over a file.
32-
It will read and execute the file first (and create it if it doesn't exist).
33-
It will also store all CLI commands you type inside of it (after evaluating them).
34-
Press enter in the CLI to re-run the whole file (useful if you want to code in the file instead of the CLI).
35-
36-
`pwr {lang} repl -f {name_of_file} -w`
37-
It will read and execute the file first (and create it if it doesn't exist).
38-
Then it will execute the file every time you save it.
39-
It will not listen to CLI input if you use this option ("-w").
40-
41-
### New
42-
`pwr {lang} new -f {name_of_file}`
43-
Creates a new file of the specified name for the script wrap.
44-
It uses a template for that language.
45-
46-
### Build
47-
`pwr {lang} build -f {name_of_file}`
48-
Builds the target script file.
49-
50-
### Deploy
51-
`pwr deploy`
52-
Deploys the build directory.
53-
54-
`pwr {lang} deploy`
55-
Deploys the build directory. (Same as `pwr deploy`)
56-
57-
`pwr {lang} deploy -f {name_of_file}`
58-
Builds and then deploys the script file.
59-
60-
## TODO: Examples PWR app usage:
61-
Input: `pwr wrap://ens/wrap-echo.eth Hello world!`
62-
Output: `Hello world!`
63-
64-
Input: `pwr ens/wrap-echo.eth Hello world!`
65-
Output: `Hello world!`
66-
67-
Input: `pwr wrap-echo.eth Hello world!`
68-
Output: `Hello world!`
69-
70-
Input: `pwr wrap://ipfs/QmebzauKAXoYbywLAYdBvKyPhWsDoHfkUC4wffWvjighKT Hello world!`
71-
Output: `Hello world!`
72-
73-
Input: `pwr ipfs/QmebzauKAXoYbywLAYdBvKyPhWsDoHfkUC4wffWvjighKT Hello world!`
74-
Output: `Hello world!`
75-
76-
Input: `pwr ipfs://QmebzauKAXoYbywLAYdBvKyPhWsDoHfkUC4wffWvjighKT Hello world!`
77-
Output: `Hello world!`
78-
79-
Input: `pwr QmebzauKAXoYbywLAYdBvKyPhWsDoHfkUC4wffWvjighKT Hello world!`
80-
Output: `Hello world!`
24+
[Example PWR Usage](./docs/pwr-usage.md)
8125

26+
[Example PWR Apps](./docs/pwr-apps.md)
8227

28+
[Script WRAPS Guide](./docs/script-wraps.md)

docs/pwr-apps.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# PWR App Examples
2+
3+
- [Simple PWR App](../examples/simple-pwr-app/README.md)
4+
- [Simple Storage App](../examples/simple-storage-app/README.md)
5+
- [HTTP Server App](../examples/http-server-app/README.md)
6+
- [Advanced HTTP Server App](../examples/app-with-ui/README.md)
7+
- [PWR App with UI](../examples/app-with-ui/README.md)

docs/pwr-usage.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Example PWR CLI usage:
2+
3+
## Migration
4+
After running `pwrup`, you have to run `pwr migrate` to migrate your configuration to the latest version.
5+
6+
## Running pwr apps
7+
8+
### From wrapscan.io
9+
To run a pwr app from wrapscan.io, run:
10+
```bash
11+
pwr wrapscan.io/pwr/say-hello
12+
```
13+
14+
### From wrappers.dev
15+
To run a pwr app from wrappers.dev, run:
16+
```bash
17+
pwr @pwr/say-hello
18+
```
19+
```bash
20+
pwr https/wrappers.dev/u/pwr/say-hello
21+
```
22+
23+
### Local directory
24+
To run a pwr app from a local directory (e.g. `./build`), run:
25+
```bash
26+
pwr ./build
27+
```
28+
```bash
29+
pwr fs/build
30+
```
31+
32+
### From IPFS
33+
To run a pwr app from IPFS, run:
34+
```bash
35+
pwr ipfs/Qm...
36+
```
37+
```bash
38+
pwr Qm...
39+
```
40+
```bash
41+
pwr ipfs://Qm...
42+
```
43+
44+
### From ENS
45+
To run a pwr app from ENS, run:
46+
```bash
47+
pwr ens/say-hello.eth
48+
```
49+
```bash
50+
pwr say-hello.eth
51+
```
52+
53+
## Passing arguments to pwr apps
54+
To pass arguments to a pwr app add them after the WRAP URI, e.g.:
55+
```bash
56+
pwr ./build arg1 arg2
57+
```

docs/script-wraps.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Script WRAPS (JS and Python)
2+
{lang} = js | py
3+
4+
### REPL
5+
`pwr {lang} repl`
6+
Runs a REPL where you can type scripts.
7+
8+
`pwr {lang} repl -f {name_of_file}`
9+
Runs the repl over a file.
10+
It will read and execute the file first (and create it if it doesn't exist).
11+
It will also store all CLI commands you type inside of it (after evaluating them).
12+
Press enter in the CLI to re-run the whole file (useful if you want to code in the file instead of the CLI).
13+
14+
`pwr {lang} repl -f {name_of_file} -w`
15+
It will read and execute the file first (and create it if it doesn't exist).
16+
Then it will execute the file every time you save it.
17+
It will not listen to CLI input if you use this option ("-w").
18+
19+
### New
20+
`pwr {lang} new -f {name_of_file}`
21+
Creates a new file of the specified name for the script wrap.
22+
It uses a template for that language.
23+
24+
### Build
25+
`pwr {lang} build -f {name_of_file}`
26+
Builds the target script file.
27+
28+
### Deploy
29+
`pwr deploy`
30+
Deploys the build directory.
31+
32+
`pwr {lang} deploy`
33+
Deploys the build directory. (Same as `pwr deploy`)
34+
35+
`pwr {lang} deploy -f {name_of_file}`
36+
Builds and then deploys the script file.

examples/app-with-ui/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!src/wrap

examples/app-with-ui/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v16.13.0

examples/app-with-ui/Cargo.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[package]
2+
name = "app_with_ui"
3+
version = "0.1.0"
4+
description = "An example of a PWR HTTP server application with UI"
5+
6+
edition.workspace = true
7+
rust-version.workspace = true
8+
license.workspace = true
9+
10+
[dependencies]
11+
polywrap_msgpack_serde.workspace = true
12+
polywrap-wasm-rs.workspace = true
13+
serde = { version = "1.0", features = ["derive"] }
14+
serde_bytes.workspace = true
15+
16+
[lib]
17+
crate-type = ["cdylib"]
18+
19+
[profile.release]
20+
opt-level = 's'
21+
lto = true
22+
panic = 'abort'

examples/app-with-ui/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# App with UI
2+
An example of a PWR HTTP server application with UI

0 commit comments

Comments
 (0)