Skip to content

Commit

Permalink
Updated documentation for v0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Panayotis Vryonis committed Oct 28, 2023
1 parent 601f826 commit ac6d486
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 35 deletions.
30 changes: 17 additions & 13 deletions HOWTO/Create_and_use_Signers_with_fario.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,29 @@ often also called "seed phrase" or "mnemonic".
2. The *app*. This is the application (or any other Farcaster account),
identified by `app_fid` and the corresponding private key `app_key` (just like the user account).

You can either set these values in your `.env` file, or pass them as
parameters to the commands we will use later. To make this guide more
eligible, I will assume that you have set these values in `.env`.
You can either set these values in `~/.fario` (will work with homebrew installations),
in `.env` or pass them as parameters to the commands we will use later. To make this guide more
eligible, I will assume that you have set these values in `~/.fario`.

It is easy to generate a `.fario` template by running `fario-config make`.

You will also need to [configure a hub](How_to_get_access_to_a_hub.md) and an
Ethereum provider such as alchemy or infura.

```
# your .env file will look like this
FARCASTER_HUB="IP:port"
# your ~/.fario file will look like this
OP_ETH_PROVIDER="https://opt-mainnet.g.alchemy.com/v2/........"
hub="IP:PORT"
user_fid=280 # this is my own account, @vrypan.eth
user_key="<set user's private key here>"
app_fid=20396 # this is @fc1, my test app.
app_key="<set app's private key here>"
op_eth_provider="https://opt-mainnet.g.alchemy.com/v2/........"
APP_FID=20396 # this is @fc1, my test app.
APP_PRIVATE_KEY="<set app's private key here>"
# since we will be creating a new signer, leave this blank to make the
# exxamples more clear.
signer=""
USER_FID=280 # this is my own account, @vrypan.eth
USER_PRIVATE_KEY="<set user's private key here>"
```

## Create a Signer
Expand Down Expand Up @@ -88,7 +92,7 @@ OK: The last line contains our Signer public key.

Now, **ANYONE** who holds the Signer private key can cast on behalf of my account, @vrypan.eth.

`fario-cast --key=$SIGNER_KEY --fid=280 "Hello world"`
`fario-cast --key=$SIGNER_KEY --user-fid=280 "Hello world"`

I waited a few seconds, and refreshed my profile:

Expand All @@ -111,7 +115,7 @@ You can see the transaction [here](https://optimistic.etherscan.io/tx/0xb48a5ad9
Let's try to use the Signer again.

```
fario-cast --key=$SIGNER_KEY --fid=280 "Hello world"
fario-cast --key=$SIGNER_KEY --user-fid=280 "Hello world"
Traceback (most recent call last):
File "/Users/vrypan/Devel/far/venv/bin/fario-cast", line 8, in <module>
Expand Down
111 changes: 89 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Visit the [HOWTO folder](HOWTO/) to learn more.

(Any help packaging these scripts as a brew recipe, apt package, etc., will be appreciated!)

New commands: `fario-out`, `fario-in`, `fario-signers`, `fario-cast`.
Commands: `fario-out`, `fario-in`, `fario-signers`, `fario-cast`, `fario-config`, `fario2json`, `json2fario`, `fario-id-byname`, `fario-account`.

Most of these command will require you to have access to a Farcaster hub: [How to get access to a hub](HOWTO/How_to_get_access_to_a_hub.md).

Expand All @@ -56,23 +56,25 @@ Most of the scripts bellow pipe farcaster `Message` objects in and/or out. To ma
`fario-out` is used to export data from a farcaster hub.

```
usage: fario-out [-h] [--casts] [--links] [--recasts] [--likes] [--profile] [--all] [--limit LIMIT] [--hub HUB] [--wait WAIT] fid
usage: fario-out [-h] [--version] [--casts] [--links] [--recasts] [--likes] [--inlinks] [--profile] [--all] [--limit LIMIT] [--hub HUB] [--wait WAIT] fid
Export Farcaster data.
positional arguments:
fid FID
fid Export messages from fid=FID
options:
-h, --help show this help message and exit
--version show program's version number and exit
--casts User casts
--links User links
--recasts User recasts
--likes User likes
--inlinks Inbound links for user
--profile User profile data
--all Equivalent to --casts --links --recasts --likes --profile
--limit LIMIT Number of records. If more than one types of data are exported, the limit applies to each one separately.
--hub HUB Use the hub at <ADDRESS>. Ex. --hub 192.168.1.1:2283
--hub HUB Use the hub at <HUB>. Ex. --hub 192.168.1.1:2283
--wait WAIT Wait for <WAIT> milliseconds between reads.
```

Expand Down Expand Up @@ -128,13 +130,16 @@ Try: `fario-out --all --limit=5 2 | fario2json | jq`
`fario-in` is used to post data (messages) to a farcaster hub. Input is read from stdin and it is expected to be base64 encoded serialized protobuf messages, like the ones exported by `fario-out`.

```
usage: fario-in [-h] [--hub HUB] [--wait WAIT]
fario-in --help
usage: fario-in [-h] [--version] [--hub HUB] [--wait WAIT]
Send messages to Farcaster hub.
options:
-h, --help show this help message and exit
--hub HUB Use the hub at <ADDRESS>. Ex. --hub 192.168.1.1:2283
--version show program's version number and exit
--hub HUB Use the hub at <HUB>. Ex. --hub 192.168.1.1:2283
--wait WAIT Wait for <WAIT> milliseconds between message submissions.
```

Expand Down Expand Up @@ -162,17 +167,17 @@ Create a new signer for an application and approve it using a user's private key
```
fario-signers add --help
usage: fario-signers add [-h] [--provider PROVIDER] [--user_fid USER_FID] [--user_key USER_KEY] [--app_fid APP_FID] [--app_key APP_KEY]
usage: fario-signers add [-h] [--provider PROVIDER] [--user-fid USER_FID] [--user-key USER_KEY] [--app-fid APP_FID] [--app-key APP_KEY]
Create a new signer. Using --raw will output tx_hash, user_fis, app_fid, signer_bublic_key, signer_private_key as a tab-separated list.
options:
-h, --help show this help message and exit
--provider PROVIDER OP Eth provider endpoint
--user_fid USER_FID User's fid.
--user_key USER_KEY User's private key in hex.
--app_fid APP_FID Application's fid.
--app_key APP_KEY Application's private key in hex.
--user-fid USER_FID User's fid.
--user-key USER_KEY User's private key in hex.
--app-fid APP_FID Application's fid.
--app-key APP_KEY Application's private key in hex.
```

## fario-signers remove
Expand All @@ -182,17 +187,18 @@ Remove a signer already approved by a user.
```
fario-signers remove --help
usage: fario-signers remove [-h] [--provider PROVIDER] [--user_key USER_KEY] signer
usage: fario-signers remove [-h] [--op_eth_provider OP_ETH_PROVIDER] [--user-key USER_KEY] signer
Remove a signer. Using --raw will output only the tx_hash.
positional arguments:
signer Signer's public key in hex.
signer Signer's public key in hex.
options:
-h, --help show this help message and exit
--provider PROVIDER OP Eth provider endpoint
--user_key USER_KEY User's private key in hex.
-h, --help show this help message and exit
--op_eth_provider OP_ETH_PROVIDER
OP Eth provider endpoint
--user-key USER_KEY User's private key in hex.
```

## fario-signers sign
Expand All @@ -202,15 +208,14 @@ It reads messages in "far" format from stdin, signs them using a new signer, and
```
fario-signers sign --help
usage: fario-signers sign [-h] key
Sign (or re-sign) messages uing a new signer.
usage: fario-signers sign [-h] [--signer SIGNER] [--keep-hash]
positional arguments:
key Signer's private key
Read messages and sign (or re-sign) using a new signer. Reads from stdin, writes to stdout. In and out are in fario format.
options:
-h, --help show this help message and exit
-h, --help show this help message and exit
--signer SIGNER Signer's private key
--keep-hash Do not change the message hash.
```

Example:
Expand All @@ -230,6 +235,68 @@ Posting these messages to a hub can fail for various reasons:

However, you can use `fario-out` to backup your content, remove a signer (which results in all mesages signed by it to be removed!), then use `fario-signers sign` and `fario-in` to re-sign them with a new signer and upload them to farcaster!

## fario-account

Displays detailed information about an fid.

```
usage: fario-account [-h] [--version] [--raw] [--hub HUB] [--fid] [--fname] [--name] [--addr] [--storage-rent] [--storage-limits] [--storage-usage] [--recovery] [--all] {byfid,byname} ...
positional arguments:
{byfid,byname}
options:
-h, --help show this help message and exit
--version show program's version number and exit
--raw Output raw values, tab separated.
--hub HUB Use the hub at <HUB>. Ex. --hub 192.168.1.1:2283
--fid Print fid
--fname Print fname
--name Print name
--addr Print custody address
--storage-rent Print storage rent events
--storage-limits Print storage limits
--storage-usage Print storage usage
--recovery Print recovery address
--all Print all available information
```

Example

```
$ fario-account --all byname dwr
address 0x6b0bda3f2ffed5efc83fa8c024acff1dd45793f1
fname dwr
name dwr.eth
Storage Units Rented
====================
Units Date Paid by
2 2024-08-29T01:23:13 0x00000000fc94856f3967b047325f88d47bc225d0
10 2024-09-19T00:02:45 0xd7029bdea1c17493893aafe29aad69ef892b8ff2
1 2024-10-08T21:03:49 0x2d93c2f74b2c4697f9ea85d0450148aa45d4d5a2
Current Storage Limits
======================
casts 65000
links 32500
reactions 32500
user_data 650
username_proofs 65
verifications 325
Current Usage
=============
casts 15115
links 2684
likes 16467
recasts 2001
user_data 4
proofs 3
verifications 4
```

# Other commands

- `fario-cast`: cast plain text messages (no mentions, or embeds).
Expand Down

0 comments on commit ac6d486

Please sign in to comment.