Skip to content

Commit

Permalink
Link to vercel app (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
guidanoli authored Jul 18, 2024
1 parent 75e2d43 commit c05ade0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 225 deletions.
6 changes: 6 additions & 0 deletions .changeset/big-islands-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@guidanoli/cmioc": patch
"@guidanoli/cmioc-cli": patch
---

Use Vercel app as package homepage
225 changes: 2 additions & 223 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,227 +2,6 @@

In the upcoming v2 release of the Cartesi Rollups SDK, inputs and outputs will be encoded as Solidity function calldata.
This package aims to show front-end developers how inputs and outputs can be encoded or decoded using [`viem`](https://viem.sh/) and the contract ABIs exported by [`@cartesi/rollups`](https://www.npmjs.com/package/@cartesi/rollups).
It also comes with a handy-dandy CLI tool for encoding and decoding of inputs and outputs.
It also comes with a handy-dandy CLI tool.

## Installation

You can install the package with `pnpm` by running:

```sh
pnpm add -g @guidanoli/cmioc
```

## Encoding inputs

### To hex

```sh
cmioc encode input \
--chain-id 1 \
--app-contract 0x70ac08179605AF2D9e75782b8DEcDD3c22aA4D0C \
--msg-sender 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \
--block-number 42 \
--block-timestamp 70000 \
--prev-randao 40823578488146031703637781058841789769586951870728503003341100870835983872788 \
--index 10 \
--payload 0xdeadbeef
```

Output:

```
0x415bf363000000000000000000000000000000000000000000000000000000000000000100000000000000000000000070ac08179605af2d9e75782b8decdd3c22aa4d0c000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000111705a41539c3688747a1a8c7811b98b0427331ff73aab018eb5c9921993d617f314000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000004deadbeef00000000000000000000000000000000000000000000000000000000
```

### To binary

Just add the `--binary` flag.

## Decoding inputs

### From hex

```sh
cmioc decode input 0x415bf363000000000000000000000000000000000000000000000000000000000000000100000000000000000000000070ac08179605af2d9e75782b8decdd3c22aa4d0c000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000111705a41539c3688747a1a8c7811b98b0427331ff73aab018eb5c9921993d617f314000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000004deadbeef00000000000000000000000000000000000000000000000000000000
```

or

```sh
cat input.txt | cmioc decode input
```

### From binary

```sh
cat input.bin | cmioc decode input --binary
```

Output:

```json
{
"chainId": "1",
"appContract": "0x70ac08179605AF2D9e75782b8DEcDD3c22aA4D0C",
"msgSender": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"blockNumber": "42",
"blockTimestamp": "70000",
"prevRandao": "40823578488146031703637781058841789769586951870728503003341100870835983872788",
"index": "10",
"payload": "0xdeadbeef"
}
```

## Encoding outputs

### Notices

#### To hex

```sh
cmioc encode notice \
--payload 0xdeadbeef
```

Output:

```
0xc258d6e500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004deadbeef00000000000000000000000000000000000000000000000000000000
```

#### To binary

Just add the `--binary` flag.

### Vouchers

#### To hex

```sh
cmioc encode voucher \
--destination 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \
--value 1000000000000000000 \
--payload 0xfafafa
```

Output:

```
0x237a816f000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb922660000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000003fafafa0000000000000000000000000000000000000000000000000000000000
```

#### To binary

Just add the `--binary` flag.

### `DELEGATECALL` vouchers

#### To hex

```sh
cmioc encode delegatecallvoucher \
--destination 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \
--payload 0xfafafa
```

Output:

```
0x10321e8b000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb9226600000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000003fafafa0000000000000000000000000000000000000000000000000000000000
```

#### To binary

Just add the `--binary` flag.

## Decoding outputs

### Notices

#### From hex

```sh
cmioc decode output 0xc258d6e500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004deadbeef00000000000000000000000000000000000000000000000000000000
```

or

```sh
cat notice.txt | cmioc decode output
```

#### From binary

```sh
cat notice.bin | cmioc decode output --binary
```

Output:

```json
{
"type": "notice",
"payload": "0xdeadbeef"
}
```

### Vouchers

#### From hex

```sh
cmioc decode output 0x237a816f000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb922660000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000003fafafa0000000000000000000000000000000000000000000000000000000000
```

or

```sh
cat voucher.txt | cmioc decode output
```

#### From binary

```sh
cat voucher.bin | cmioc decode output --binary
```

Output:

```json
{
"type": "voucher",
"destination": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"value": "1000000000000000000",
"payload": "0xfafafa"
}
```

### `DELEGATECALL` vouchers

#### From hex

```sh
cmioc decode output 0x10321e8b000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb9226600000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000003fafafa0000000000000000000000000000000000000000000000000000000000
```

or

```sh
cat delegatecallvoucher.txt | cmioc decode output
```

#### From binary

```sh
cat delegatecallvoucher.bin | cmioc decode output --binary
```

Output:

```json
{
"type": "delegatecallvoucher",
"destination": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"payload": "0xfafafa"
}
```
For documentation, please visit **https://cmioc.vercel.app/**.
2 changes: 1 addition & 1 deletion apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"codec",
"cli"
],
"homepage": "https://github.com/guidanoli/cmioc",
"homepage": "https://cmioc.vercel.app/",
"bugs": {
"url": "https://github.com/guidanoli/cmioc/issues"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"solidity",
"codec"
],
"homepage": "https://github.com/guidanoli/cmioc",
"homepage": "https://cmioc.vercel.app/",
"bugs": {
"url": "https://github.com/guidanoli/cmioc/issues"
},
Expand Down

0 comments on commit c05ade0

Please sign in to comment.