Add --offset flag to the wallet get_transactions command (#1802)

* Add --offset flag to the wallet get_transactions command

* Running black
This commit is contained in:
Jesús Espino 2021-04-12 07:23:49 +02:00 committed by GitHub
parent a142f10cfd
commit 181f2fefa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -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

View File

@ -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