Skip to content

Commit

Permalink
Add --offset flag to the wallet get_transactions command (Chia-Networ…
Browse files Browse the repository at this point in the history
…k#1802)

* Add --offset flag to the wallet get_transactions command

* Running black
  • Loading branch information
jespino authored Apr 12, 2021
1 parent a142f10 commit 181f2fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 11 additions & 2 deletions chia/cmds/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,18 @@ def get_transaction_cmd(wallet_rpc_port: int, fingerprint: int, id: int, tx_id:
)
@click.option("-f", "--fingerprint", help="Set the fingerprint to specify which wallet to use", type=int)
@click.option("-i", "--id", help="Id of the wallet to use", type=int, default=1, show_default=True, required=True)
@click.option(
"-o",
"--offset",
help="Skip transactions from the beginning of the list",
type=int,
default=0,
show_default=True,
required=True,
)
@click.option("--verbose", "-v", count=True, type=int)
def get_transactions_cmd(wallet_rpc_port: int, fingerprint: int, id: int, verbose: bool) -> None:
extra_params = {"id": id, "verbose": verbose}
def get_transactions_cmd(wallet_rpc_port: int, fingerprint: int, id: int, offset: int, verbose: bool) -> None:
extra_params = {"id": id, "verbose": verbose, "offset": offset}
import asyncio
from .wallet_funcs import execute_with_wallet, get_transactions

Expand Down
3 changes: 2 additions & 1 deletion chia/cmds/wallet_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ async def get_transactions(args: dict, wallet_client: WalletRpcClient, fingerpri
if len(txs) == 0:
print("There are no transactions to this address")

offset = args["offset"]
num_per_screen = 5
for i in range(0, len(txs), num_per_screen):
for i in range(offset, len(txs), num_per_screen):
for j in range(0, num_per_screen):
if i + j >= len(txs):
break
Expand Down

0 comments on commit 181f2fe

Please sign in to comment.