Skip to content

Commit

Permalink
Feature short address type (#12)
Browse files Browse the repository at this point in the history
* Short address-type option in argparse.

* Update readmes to include short option name.
  • Loading branch information
praskoson authored Jun 10, 2021
1 parent cdb43f4 commit 0b6723d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tools/address-fetcher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ The app will create an output folder in the same directory that it is ran from,
## Outputs
The folder will contain a raw JSON file that was used to get the token account info from the Solana RPC API, a list of addresses seperated by new lines and a list of addresses and their corresponding balances for the given token, seperated by a comma.

The type of addresses that will be written to output files is selected with the option `--address-type`. Possible choices are `token` and `owner`.
The type of addresses that will be written to output files is selected with the option `-t` or `--address-type`. Possible choices are `token` and `owner`.

## Usage

The available arguments are:
```
-m MINT, --mint MINT Mint address of the SPL token
--address-type {owner,token} Select the address type used in the file (owner | token).
-t {owner, token}, --address-type {owner,token} Select the address type used in the output file (owner | token).
-u URL, --url URL URL of the Solana RPC endpoint.
-e EXCLUDED, --excluded EXCLUDED Path to the file that contains all addresses that will be removed from the final list. Each address should be in a seperate line, and the file must be UTF-8 encoded.
```
Expand Down
1 change: 1 addition & 0 deletions tools/address-fetcher/address-fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def get_token_name(mint):
help='Mint address of the SPL token'
)
parser.add_argument(
'-t',
'--address-type',
dest="atype",
choices={'owner', 'token'},
Expand Down
4 changes: 2 additions & 2 deletions tools/flat-distributor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ UNCONFIRMED_LOGS=unconfirmed.log
## flat-distributor check-before
`check-before` can be used before a distribution, and will generate a CSV file containing the current balances for all recipients, and their expected balances after the distribution. The generated file will be named **before.csv** and is used as input for the `check-after` command.

It is required to specify the address type used in the address list file (`--address-type {owner|token}`) and the amount of tokens that will be distributed.
It is required to specify the address type used in the address list file (`-t` or `--address-type {owner|token}`) and the amount of tokens that will be distributed.

### Usage:
`python3 flat-distributor.py check-before -a address-list.txt --address-type owner --drop 500`
Expand Down Expand Up @@ -70,7 +70,7 @@ Execution can be interrupted at any time with SIGINT (CTRL+C).

This mode also generates a CSV file that can then be read to compare the expected vs actual balances of all recipients.

Address type must be specified with the `address-type` argument, where the type can be `owner` or `token`.
Address type must be specified with the `-t` or `address-type` argument, where the type can be `owner` or `token`.

### Usage
`python3 flat-distributor.py check-after --address-type owner --before-file before.csv`
Expand Down
2 changes: 2 additions & 0 deletions tools/flat-distributor/flat-distributor.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ def transfer(input_path, interactive, drop_amount,
help='Path to the file containing a list of addresses, seperated into new lines.'
)
parser_b.add_argument(
'-t',
'--address-type',
metavar='ADDRESS_TYPE',
dest='address_type',
Expand All @@ -563,6 +564,7 @@ def transfer(input_path, interactive, drop_amount,
parser_a = subparsers.add_parser(
'check-after', help='Run the checker after a distribution, to check if all recipients received the expected amount of tokens.')
parser_a.add_argument(
'-t',
'--address-type',
metavar='ADDRESS_TYPE',
dest='address_type',
Expand Down
2 changes: 2 additions & 0 deletions tools/proportional-distributor/proportional-distributor.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ def transfer(input_path, interactive, drop_amount,
help='Path to the file containing a list of addresses and balances, seperated by a comma, and with each pair in a seperate line.'
)
parser_b.add_argument(
'-t',
'--address-type',
metavar='ADDRESS_TYPE',
dest='address_type',
Expand All @@ -576,6 +577,7 @@ def transfer(input_path, interactive, drop_amount,
parser_a = subparsers.add_parser(
'check-after', help='Run the checker after a distribution, to check if all recipients received the expected amount of tokens.')
parser_a.add_argument(
'-t',
'--address-type',
metavar='ADDRESS_TYPE',
dest='address_type',
Expand Down

0 comments on commit 0b6723d

Please sign in to comment.