Skip to content

Commit c2527d8

Browse files
committed
Allowing configuration of http client of HttpApp
1 parent 2f8fd4c commit c2527d8

Some content is hidden

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

58 files changed

+88
-77
lines changed

.changeset/chilly-snakes-cheat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@deroll/app": patch
3+
---
4+
5+
changing createApp param name from url to baseUrl

.changeset/public-steaks-find.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@deroll/create-app": patch
3+
"@deroll/examples": patch
4+
---
5+
6+
exposing ClientOptions at HttpApp

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,22 @@ import { createApp } from "@deroll/app";
3636

3737
// Create the application
3838
const app = createApp({
39-
url: process.env.ROLLUP_HTTP_SERVER_URL || "http://127.0.0.1:5004",
39+
baseUrl: process.env.ROLLUP_HTTP_SERVER_URL || "http://127.0.0.1:5004",
4040
});
4141

4242
// Handle input encoded in hex
4343
app.addAdvanceHandler(async ({ payload }) => {
44-
// read payload as string
45-
const str = hexToString(payload);
44+
// read payload as string
45+
const str = hexToString(payload);
4646

47-
// create a notice with the string in uppercase
48-
await app.createNotice({ payload: stringToHex(str.toUpperCase()) });
47+
// create a notice with the string in uppercase
48+
await app.createNotice({ payload: stringToHex(str.toUpperCase()) });
4949
});
5050

5151
// Start the application
5252
app.start().catch((e) => {
53-
console.error(e);
54-
process.exit(1);
53+
console.error(e);
54+
process.exit(1);
5555
});
5656
```
5757

@@ -82,9 +82,9 @@ cartesi send
8282
1. Choose `Send generic input to the application.`
8383
2. After choose `Foundry`
8484
3. Select the defaults:
85-
1. Select the RPC URL `http://127.0.0.1:8545`
86-
2. Select Mnemonic
87-
3. Account, DApp address
85+
1. Select the RPC URL `http://127.0.0.1:8545`
86+
2. Select Mnemonic
87+
3. Account, DApp address
8888
4. Select `Input String encoding` and in the input type `Hello world!` and hit enter.
8989

9090
Expected output:
@@ -106,6 +106,7 @@ cartesi send
106106
Expected output in the `cartesi rollups logs` terminal:
107107

108108
```shell
109+
109110
```
110111

111112
Now you're ready to start building your Cartesi application with cartesi and deroll!
@@ -114,8 +115,8 @@ Now you're ready to start building your Cartesi application with cartesi and der
114115

115116
### Requirements
116117

117-
- Corepack (with pnpm) or pnpm v9 (9.7.1 recommended)
118-
- Node 20 or greater (LTS)
118+
- Corepack (with pnpm) or pnpm v9 (9.7.1 recommended)
119+
- Node 20 or greater (LTS)
119120

120121
### Installation
121122

apps/docs/pages/advance-handlers.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const handler: AdvanceRequestHandler = async ({ metadata, payload }) => {
1717
}
1818

1919
// create application
20-
const app = createApp({ url: "http://127.0.0.1:5004" });
20+
const app = createApp({ baseUrl: "http://127.0.0.1:5004" });
2121
app.addAdvanceHandler(handler);
2222
```
2323

@@ -31,7 +31,7 @@ By default, when a handler returns `"accept"` the execution chain stops.
3131
import { createApp } from "@deroll/app";
3232

3333
// create application
34-
const app = createApp({ url: "http://127.0.0.1:5004" });
34+
const app = createApp({ baseUrl: "http://127.0.0.1:5004" });
3535

3636
// ---cut---
3737
app.addAdvanceHandler(async (data) => {
@@ -51,7 +51,7 @@ If a handler returns `"reject"` or **raises an exception**, the next handler in
5151
import { createApp } from "@deroll/app";
5252

5353
// create application
54-
const app = createApp({ url: "http://127.0.0.1:5004" });
54+
const app = createApp({ baseUrl: "http://127.0.0.1:5004" });
5555

5656
// ---cut---
5757
app.addAdvanceHandler(async (data) => {
@@ -76,7 +76,7 @@ import { createApp } from "@deroll/app";
7676

7777
// create application
7878
const app = createApp({
79-
url: "http://127.0.0.1:5004",
79+
baseUrl: "http://127.0.0.1:5004",
8080
broadcastAdvanceRequests: true
8181
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8282
});

apps/docs/pages/app/add-advance-handler.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Below is a simple example of adding an advance handler that only logs the reques
1010
import { createApp } from "@deroll/app";
1111

1212
// create application
13-
const app = createApp({ url: "http://127.0.0.1:5004" });
13+
const app = createApp({ baseUrl: "http://127.0.0.1:5004" });
1414

1515
app.addAdvanceHandler(async ({ metadata, payload }) => { // [!code focus]
1616
console.log(metadata, payload); // [!code focus]

apps/docs/pages/app/add-inspect-handler.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Below is a simple example of adding an inspect handler that only logs the reques
1010
import { createApp } from "@deroll/app";
1111

1212
// create application
13-
const app = createApp({ url: "http://127.0.0.1:5004" });
13+
const app = createApp({ baseUrl: "http://127.0.0.1:5004" });
1414

1515
app.addInspectHandler(async ({ payload }) => { // [!code focus]
1616
console.log(payload); // [!code focus]

apps/docs/pages/app/create-app.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Below is a simple example of constructing a new `App` that fetches requests from
1010
import { createApp } from "@deroll/app";
1111

1212
// create application
13-
const app = createApp({ url: "http://127.0.0.1:5004" });
13+
const app = createApp({ baseUrl: "http://127.0.0.1:5004" });
1414
```
1515

1616
## Returns

apps/docs/pages/app/create-notice.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { createApp } from "@deroll/app";
1111
import { stringToHex } from "viem";
1212

1313
// create application
14-
const app = createApp({ url: "http://127.0.0.1:5004" });
14+
const app = createApp({ baseUrl: "http://127.0.0.1:5004" });
1515

1616
// log incoming advance request
1717
app.addAdvanceHandler(async (data) => {

apps/docs/pages/app/create-report.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { createApp } from "@deroll/app";
1313
import { stringToHex } from "viem";
1414

1515
// create application
16-
const app = createApp({ url: "http://127.0.0.1:5004" });
16+
const app = createApp({ baseUrl: "http://127.0.0.1:5004" });
1717

1818
// log incoming advance request
1919
app.addAdvanceHandler(async (data) => {

apps/docs/pages/app/create-voucher.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { createApp } from "@deroll/app";
1111
import { encodeFunctionData, erc20Abi, parseUnits } from "viem";
1212

1313
// create application
14-
const app = createApp({ url: "http://127.0.0.1:5004" });
14+
const app = createApp({ baseUrl: "http://127.0.0.1:5004" });
1515

1616
// log incoming advance request
1717
app.addAdvanceHandler(async (data) => {

0 commit comments

Comments
 (0)