forked from TrueCloudLab/frostfs-testlib
Add keywords helpers
Signed-off-by: Vladimir Avdeev <v.avdeev@yadro.com>
This commit is contained in:
parent
f907de52cf
commit
aebec54495
18 changed files with 637 additions and 125 deletions
|
@ -1,11 +1,12 @@
|
|||
from typing import Optional
|
||||
|
||||
from neofs_testlib.shell import CommandResult, Shell
|
||||
from neofs_testlib.shell import CommandOptions, CommandResult, InteractiveInput, Shell
|
||||
|
||||
|
||||
class CliCommand:
|
||||
|
||||
WALLET_SOURCE_ERROR_MSG = "Provide either wallet or wallet_config to specify wallet location"
|
||||
WALLET_PASSWD_ERROR_MSG = "Provide either wallet_password or wallet_config to specify password"
|
||||
|
||||
cli_exec_path: Optional[str] = None
|
||||
__base_params: Optional[str] = None
|
||||
|
@ -14,6 +15,8 @@ class CliCommand:
|
|||
"await_mode": "await",
|
||||
"hash_type": "hash",
|
||||
"doc_type": "type",
|
||||
"to_address": "to",
|
||||
"from_address": "from",
|
||||
}
|
||||
|
||||
def __init__(self, shell: Shell, cli_exec_path: str, **base_params):
|
||||
|
@ -26,6 +29,9 @@ class CliCommand:
|
|||
def _format_command(self, command: str, **params) -> str:
|
||||
param_str = []
|
||||
for param, value in params.items():
|
||||
if param == "post_data":
|
||||
param_str.append(value)
|
||||
continue
|
||||
if param in self.map_params.keys():
|
||||
param = self.map_params[param]
|
||||
param = param.replace("_", "-")
|
||||
|
@ -56,3 +62,11 @@ class CliCommand:
|
|||
|
||||
def _execute(self, command: Optional[str], **params) -> CommandResult:
|
||||
return self.shell.exec(self._format_command(command, **params))
|
||||
|
||||
def _execute_with_password(self, command: Optional[str], password, **params) -> CommandResult:
|
||||
return self.shell.exec(
|
||||
self._format_command(command, **params),
|
||||
options=CommandOptions(
|
||||
interactive_inputs=[InteractiveInput(prompt_pattern="assword", input=password)]
|
||||
),
|
||||
)
|
||||
|
|
|
@ -11,6 +11,7 @@ class NeoGoCandidate(CliCommand):
|
|||
rpc_endpoint: str,
|
||||
wallet: Optional[str] = None,
|
||||
wallet_config: Optional[str] = None,
|
||||
wallet_password: Optional[str] = None,
|
||||
gas: Optional[float] = None,
|
||||
timeout: int = 10,
|
||||
) -> CommandResult:
|
||||
|
@ -21,6 +22,7 @@ class NeoGoCandidate(CliCommand):
|
|||
wallet: Target location of the wallet file ('-' to read from stdin);
|
||||
conflicts with --wallet-config flag.
|
||||
wallet_config: Target location of the wallet config file; conflicts with --wallet flag.
|
||||
wallet_password: Wallet password.
|
||||
gas: Network fee to add to the transaction (prioritizing it).
|
||||
rpc_endpoint: RPC node address.
|
||||
timeout: Timeout for the operation (default: 10s).
|
||||
|
@ -29,15 +31,20 @@ class NeoGoCandidate(CliCommand):
|
|||
Command's result.
|
||||
"""
|
||||
assert bool(wallet) ^ bool(wallet_config), self.WALLET_SOURCE_ERROR_MSG
|
||||
exec_param = {
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self", "wallet_password"]
|
||||
}
|
||||
exec_param["timeout"] = f"{timeout}s"
|
||||
if wallet_password is not None:
|
||||
return self._execute_with_password(
|
||||
"wallet candidate register", wallet_password, **exec_param
|
||||
)
|
||||
if wallet_config:
|
||||
return self._execute("wallet candidate register", **exec_param)
|
||||
|
||||
return self._execute(
|
||||
"wallet candidate register",
|
||||
**{
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
},
|
||||
)
|
||||
raise Exception(self.WALLET_PASSWD_ERROR_MSG)
|
||||
|
||||
def unregister(
|
||||
self,
|
||||
|
@ -45,6 +52,7 @@ class NeoGoCandidate(CliCommand):
|
|||
rpc_endpoint: str,
|
||||
wallet: Optional[str] = None,
|
||||
wallet_config: Optional[str] = None,
|
||||
wallet_password: Optional[str] = None,
|
||||
gas: Optional[float] = None,
|
||||
timeout: int = 10,
|
||||
) -> CommandResult:
|
||||
|
@ -55,6 +63,7 @@ class NeoGoCandidate(CliCommand):
|
|||
wallet: Target location of the wallet file ('-' to read from stdin);
|
||||
conflicts with --wallet-config flag.
|
||||
wallet_config: Target location of the wallet config file; conflicts with --wallet flag.
|
||||
wallet_password: Wallet password.
|
||||
gas: Network fee to add to the transaction (prioritizing it).
|
||||
rpc_endpoint: RPC node address.
|
||||
timeout: Timeout for the operation (default: 10s).
|
||||
|
@ -63,22 +72,29 @@ class NeoGoCandidate(CliCommand):
|
|||
Command's result.
|
||||
"""
|
||||
assert bool(wallet) ^ bool(wallet_config), self.WALLET_SOURCE_ERROR_MSG
|
||||
exec_param = {
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self", "wallet_password"]
|
||||
}
|
||||
exec_param["timeout"] = f"{timeout}s"
|
||||
if wallet_password is not None:
|
||||
return self._execute_with_password(
|
||||
"wallet candidate unregister", wallet_password, **exec_param
|
||||
)
|
||||
if wallet_config:
|
||||
return self._execute("wallet candidate unregister", **exec_param)
|
||||
|
||||
return self._execute(
|
||||
"wallet candidate unregister",
|
||||
**{
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
},
|
||||
)
|
||||
raise Exception(self.WALLET_PASSWD_ERROR_MSG)
|
||||
|
||||
def vote(
|
||||
self,
|
||||
address: str,
|
||||
candidate: str,
|
||||
rpc_endpoint: str,
|
||||
wallet: Optional[str] = None,
|
||||
wallet_config: Optional[str] = None,
|
||||
wallet_password: Optional[str] = None,
|
||||
gas: Optional[float] = None,
|
||||
timeout: int = 10,
|
||||
) -> CommandResult:
|
||||
|
@ -88,10 +104,12 @@ class NeoGoCandidate(CliCommand):
|
|||
candidate argument to perform unvoting.
|
||||
|
||||
Args:
|
||||
address: Address to vote from
|
||||
candidate: Public key of candidate to vote for.
|
||||
wallet: Target location of the wallet file ('-' to read from stdin);
|
||||
conflicts with --wallet-config flag.
|
||||
wallet_config: Target location of the wallet config file; conflicts with --wallet flag.
|
||||
wallet_password: Wallet password.
|
||||
gas: Network fee to add to the transaction (prioritizing it).
|
||||
rpc_endpoint: RPC node address.
|
||||
timeout: Timeout for the operation (default: 10s).
|
||||
|
@ -100,12 +118,17 @@ class NeoGoCandidate(CliCommand):
|
|||
Command's result.
|
||||
"""
|
||||
assert bool(wallet) ^ bool(wallet_config), self.WALLET_SOURCE_ERROR_MSG
|
||||
exec_param = {
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self", "wallet_password"]
|
||||
}
|
||||
exec_param["timeout"] = f"{timeout}s"
|
||||
if wallet_password is not None:
|
||||
return self._execute_with_password(
|
||||
"wallet candidate vote", wallet_password, **exec_param
|
||||
)
|
||||
if wallet_config:
|
||||
return self._execute("wallet candidate vote", **exec_param)
|
||||
|
||||
return self._execute(
|
||||
"wallet candidate vote",
|
||||
**{
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
},
|
||||
)
|
||||
raise Exception(self.WALLET_PASSWD_ERROR_MSG)
|
||||
|
|
|
@ -45,11 +45,12 @@ class NeoGoContract(CliCommand):
|
|||
self,
|
||||
address: str,
|
||||
input_file: str,
|
||||
sysgas: float,
|
||||
manifest: str,
|
||||
rpc_endpoint: str,
|
||||
sysgas: Optional[float] = None,
|
||||
wallet: Optional[str] = None,
|
||||
wallet_config: Optional[str] = None,
|
||||
wallet_password: Optional[str] = None,
|
||||
gas: Optional[float] = None,
|
||||
out: Optional[str] = None,
|
||||
force: bool = False,
|
||||
|
@ -62,6 +63,7 @@ class NeoGoContract(CliCommand):
|
|||
conflicts with wallet_config.
|
||||
wallet_config: Path to wallet config to use to get the key for transaction signing;
|
||||
conflicts with wallet.
|
||||
wallet_password: Wallet password.
|
||||
address: Address to use as transaction signee (and gas source).
|
||||
gas: Network fee to add to the transaction (prioritizing it).
|
||||
sysgas: System fee to add to transaction (compensating for execution).
|
||||
|
@ -77,15 +79,26 @@ class NeoGoContract(CliCommand):
|
|||
Command's result.
|
||||
"""
|
||||
assert bool(wallet) ^ bool(wallet_config), self.WALLET_SOURCE_ERROR_MSG
|
||||
exec_param = {
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self", "wallet_password"]
|
||||
}
|
||||
exec_param["timeout"] = f"{timeout}s"
|
||||
|
||||
return self._execute(
|
||||
"contract deploy",
|
||||
**{
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
},
|
||||
)
|
||||
if wallet_password is not None:
|
||||
return self._execute_with_password(
|
||||
"contract deploy",
|
||||
wallet_password,
|
||||
**exec_param,
|
||||
)
|
||||
if wallet_config:
|
||||
return self._execute(
|
||||
"contract deploy",
|
||||
**exec_param,
|
||||
)
|
||||
|
||||
raise Exception(self.WALLET_PASSWD_ERROR_MSG)
|
||||
|
||||
def generate_wrapper(
|
||||
self,
|
||||
|
@ -116,13 +129,14 @@ class NeoGoContract(CliCommand):
|
|||
|
||||
def invokefunction(
|
||||
self,
|
||||
address: str,
|
||||
scripthash: str,
|
||||
address: Optional[str] = None,
|
||||
wallet: Optional[str] = None,
|
||||
method: Optional[str] = None,
|
||||
arguments: Optional[str] = None,
|
||||
multisig_hash: Optional[str] = None,
|
||||
wallet_config: Optional[str] = None,
|
||||
wallet_password: Optional[str] = None,
|
||||
gas: Optional[float] = None,
|
||||
sysgas: Optional[float] = None,
|
||||
out: Optional[str] = None,
|
||||
|
@ -147,6 +161,7 @@ class NeoGoContract(CliCommand):
|
|||
conflicts with wallet_config.
|
||||
wallet_config: Path to wallet config to use to get the key for transaction signing;
|
||||
conflicts with wallet.
|
||||
wallet_password: Wallet password.
|
||||
address: Address to use as transaction signee (and gas source).
|
||||
gas: Network fee to add to the transaction (prioritizing it).
|
||||
sysgas: System fee to add to transaction (compensating for execution).
|
||||
|
@ -158,21 +173,40 @@ class NeoGoContract(CliCommand):
|
|||
Returns:
|
||||
Command's result.
|
||||
"""
|
||||
|
||||
assert bool(wallet) ^ bool(wallet_config), self.WALLET_SOURCE_ERROR_MSG
|
||||
|
||||
multisig_hash = f"-- {multisig_hash}" or ""
|
||||
return self._execute(
|
||||
"contract invokefunction "
|
||||
f"{scripthash} {method or ''} {arguments or ''} {multisig_hash}",
|
||||
**{
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self", "scripthash", "method", "arguments", "multisig_hash"]
|
||||
},
|
||||
)
|
||||
post_data = f"{scripthash} {method or ''} {arguments or ''} {multisig_hash}"
|
||||
exec_param = {
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param
|
||||
not in [
|
||||
"self",
|
||||
"scripthash",
|
||||
"method",
|
||||
"arguments",
|
||||
"multisig_hash",
|
||||
"wallet_password",
|
||||
]
|
||||
}
|
||||
exec_param["timeout"] = f"{timeout}s"
|
||||
exec_param["post_data"] = post_data
|
||||
if wallet_password is not None:
|
||||
return self._execute_with_password(
|
||||
"contract invokefunction", wallet_password, **exec_param
|
||||
)
|
||||
if wallet_config:
|
||||
return self._execute("contract invokefunction", **exec_param)
|
||||
|
||||
raise Exception(self.WALLET_PASSWD_ERROR_MSG)
|
||||
|
||||
def testinvokefunction(
|
||||
self,
|
||||
scripthash: str,
|
||||
wallet: Optional[str] = None,
|
||||
wallet_password: Optional[str] = None,
|
||||
method: Optional[str] = None,
|
||||
arguments: Optional[str] = None,
|
||||
multisig_hash: Optional[str] = None,
|
||||
|
@ -192,6 +226,8 @@ class NeoGoContract(CliCommand):
|
|||
|
||||
Args:
|
||||
scripthash: Function hash.
|
||||
wallet: Wallet to use for testinvoke.
|
||||
wallet_password: Wallet password.
|
||||
method: Call method.
|
||||
arguments: Method arguments.
|
||||
multisig_hash: Multisig hash.
|
||||
|
@ -201,16 +237,29 @@ class NeoGoContract(CliCommand):
|
|||
Returns:
|
||||
Command's result.
|
||||
"""
|
||||
multisig_hash = f"-- {multisig_hash}" or ""
|
||||
return self._execute(
|
||||
"contract testinvokefunction "
|
||||
f"{scripthash} {method or ''} {arguments or ''} {multisig_hash}",
|
||||
**{
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self", "scripthash", "method", "arguments", "multisig_hash"]
|
||||
},
|
||||
)
|
||||
multisig_hash = f"-- {multisig_hash}" if multisig_hash else ""
|
||||
post_data = f"{scripthash} {method or ''} {arguments or ''} {multisig_hash}"
|
||||
exec_param = {
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param
|
||||
not in [
|
||||
"self",
|
||||
"scripthash",
|
||||
"method",
|
||||
"arguments",
|
||||
"multisig_hash",
|
||||
"wallet_password",
|
||||
]
|
||||
}
|
||||
exec_param["timeout"] = f"{timeout}s"
|
||||
exec_param["post_data"] = post_data
|
||||
if wallet_password is not None:
|
||||
return self._execute_with_password(
|
||||
"contract testinvokefunction", wallet_password, **exec_param
|
||||
)
|
||||
|
||||
return self._execute("contract testinvokefunction", **exec_param)
|
||||
|
||||
def testinvokescript(
|
||||
self,
|
||||
|
@ -231,13 +280,13 @@ class NeoGoContract(CliCommand):
|
|||
Returns:
|
||||
Command's result.
|
||||
"""
|
||||
exec_param = {
|
||||
param: param_value for param, param_value in locals().items() if param not in ["self"]
|
||||
}
|
||||
exec_param["timeout"] = f"{timeout}s"
|
||||
return self._execute(
|
||||
f"contract testinvokescript",
|
||||
**{
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
},
|
||||
"contract testinvokescript",
|
||||
**exec_param,
|
||||
)
|
||||
|
||||
def init(self, name: str, skip_details: bool = False) -> CommandResult:
|
||||
|
@ -313,14 +362,18 @@ class NeoGoContract(CliCommand):
|
|||
address: str,
|
||||
wallet: Optional[str] = None,
|
||||
wallet_config: Optional[str] = None,
|
||||
wallet_password: Optional[str] = None,
|
||||
sender: Optional[str] = None,
|
||||
nef: Optional[str] = None,
|
||||
) -> CommandResult:
|
||||
"""Adds group to the manifest.
|
||||
|
||||
Args:
|
||||
wallet: Wallet to use to get the key for transaction signing; conflicts with wallet_config.
|
||||
wallet_config: Path to wallet config to use to get the key for transaction signing; conflicts with wallet.
|
||||
wallet: Wallet to use to get the key for transaction signing;
|
||||
conflicts with wallet_config.
|
||||
wallet_config: Path to wallet config to use to get the key for transaction signing;
|
||||
conflicts with wallet.
|
||||
wallet_password: Wallet password.
|
||||
sender: Deploy transaction sender.
|
||||
address: Account to sign group with.
|
||||
nef: Path to the NEF file.
|
||||
|
@ -329,11 +382,17 @@ class NeoGoContract(CliCommand):
|
|||
Returns:
|
||||
Command's result.
|
||||
"""
|
||||
return self._execute(
|
||||
"contract manifest add-group",
|
||||
**{
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
},
|
||||
)
|
||||
assert bool(wallet) ^ bool(wallet_config), self.WALLET_SOURCE_ERROR_MSG
|
||||
exec_param = {
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self", "wallet_password"]
|
||||
}
|
||||
if wallet_password is not None:
|
||||
return self._execute_with_password(
|
||||
"contract manifest add-group", wallet_password, **exec_param
|
||||
)
|
||||
if wallet_config:
|
||||
return self._execute("contract manifest add-group", **exec_param)
|
||||
|
||||
raise Exception(self.WALLET_PASSWD_ERROR_MSG)
|
||||
|
|
|
@ -24,7 +24,7 @@ class NeoGo:
|
|||
def __init__(
|
||||
self,
|
||||
shell: Shell,
|
||||
neo_go_exec_path: Optional[str] = None,
|
||||
neo_go_exec_path: str,
|
||||
config_path: Optional[str] = None,
|
||||
):
|
||||
self.candidate = NeoGoCandidate(shell, neo_go_exec_path, config_path=config_path)
|
||||
|
|
|
@ -29,14 +29,13 @@ class NeoGoNep17(CliCommand):
|
|||
Command's result.
|
||||
"""
|
||||
assert bool(wallet) ^ bool(wallet_config), self.WALLET_SOURCE_ERROR_MSG
|
||||
|
||||
exec_param = {
|
||||
param: param_value for param, param_value in locals().items() if param not in ["self"]
|
||||
}
|
||||
exec_param["timeout"] = f"{timeout}s"
|
||||
return self._execute(
|
||||
"wallet nep17 balance",
|
||||
**{
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
},
|
||||
**exec_param,
|
||||
)
|
||||
|
||||
def import_token(
|
||||
|
@ -63,14 +62,13 @@ class NeoGoNep17(CliCommand):
|
|||
Command's result.
|
||||
"""
|
||||
assert bool(wallet) ^ bool(wallet_config), self.WALLET_SOURCE_ERROR_MSG
|
||||
|
||||
exec_param = {
|
||||
param: param_value for param, param_value in locals().items() if param not in ["self"]
|
||||
}
|
||||
exec_param["timeout"] = f"{timeout}s"
|
||||
return self._execute(
|
||||
"wallet nep17 import",
|
||||
**{
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
},
|
||||
**exec_param,
|
||||
)
|
||||
|
||||
def info(
|
||||
|
@ -133,10 +131,11 @@ class NeoGoNep17(CliCommand):
|
|||
self,
|
||||
token: str,
|
||||
to_address: str,
|
||||
sysgas: float,
|
||||
rpc_endpoint: str,
|
||||
sysgas: Optional[float] = None,
|
||||
wallet: Optional[str] = None,
|
||||
wallet_config: Optional[str] = None,
|
||||
wallet_password: Optional[str] = None,
|
||||
out: Optional[str] = None,
|
||||
from_address: Optional[str] = None,
|
||||
force: bool = False,
|
||||
|
@ -156,6 +155,7 @@ class NeoGoNep17(CliCommand):
|
|||
wallet: Target location of the wallet file ('-' to read from stdin);
|
||||
conflicts with --wallet-config flag.
|
||||
wallet_config: Target location of the wallet config file; conflicts with --wallet flag.
|
||||
wallet_password: Wallet password.
|
||||
out: File to put JSON transaction to.
|
||||
from_address: Address to send an asset from.
|
||||
to_address: Address to send an asset to.
|
||||
|
@ -172,15 +172,26 @@ class NeoGoNep17(CliCommand):
|
|||
Command's result.
|
||||
"""
|
||||
assert bool(wallet) ^ bool(wallet_config), self.WALLET_SOURCE_ERROR_MSG
|
||||
exec_param = {
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self", "wallet_password"]
|
||||
}
|
||||
exec_param["timeout"] = f"{timeout}s"
|
||||
|
||||
return self._execute(
|
||||
"wallet nep17 transfer",
|
||||
**{
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
},
|
||||
)
|
||||
if wallet_password is not None:
|
||||
return self._execute_with_password(
|
||||
"wallet nep17 transfer",
|
||||
wallet_password,
|
||||
**exec_param,
|
||||
)
|
||||
if wallet_config:
|
||||
return self._execute(
|
||||
"wallet nep17 transfer",
|
||||
**exec_param,
|
||||
)
|
||||
|
||||
raise Exception(self.WALLET_PASSWD_ERROR_MSG)
|
||||
|
||||
def multitransfer(
|
||||
self,
|
||||
|
@ -219,12 +230,11 @@ class NeoGoNep17(CliCommand):
|
|||
Command's result.
|
||||
"""
|
||||
assert bool(wallet) ^ bool(wallet_config), self.WALLET_SOURCE_ERROR_MSG
|
||||
|
||||
exec_param = {
|
||||
param: param_value for param, param_value in locals().items() if param not in ["self"]
|
||||
}
|
||||
exec_param["timeout"] = f"{timeout}s"
|
||||
return self._execute(
|
||||
"wallet nep17 multitransfer",
|
||||
**{
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
},
|
||||
**exec_param,
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@ from neofs_testlib.shell import CommandResult
|
|||
|
||||
|
||||
class NeoGoQuery(CliCommand):
|
||||
def candidates(self, rpc_endpoint: str, timeout: int = 10) -> CommandResult:
|
||||
def candidates(self, rpc_endpoint: str, timeout: str = "10s") -> CommandResult:
|
||||
"""Get candidates and votes.
|
||||
|
||||
Args:
|
||||
|
@ -22,7 +22,7 @@ class NeoGoQuery(CliCommand):
|
|||
},
|
||||
)
|
||||
|
||||
def committee(self, rpc_endpoint: str, timeout: int = 10) -> CommandResult:
|
||||
def committee(self, rpc_endpoint: str, timeout: str = "10s") -> CommandResult:
|
||||
"""Get committee list.
|
||||
|
||||
Args:
|
||||
|
@ -41,7 +41,7 @@ class NeoGoQuery(CliCommand):
|
|||
},
|
||||
)
|
||||
|
||||
def height(self, rpc_endpoint: str, timeout: int = 10) -> CommandResult:
|
||||
def height(self, rpc_endpoint: str, timeout: str = "10s") -> CommandResult:
|
||||
"""Get node height.
|
||||
|
||||
Args:
|
||||
|
@ -60,7 +60,7 @@ class NeoGoQuery(CliCommand):
|
|||
},
|
||||
)
|
||||
|
||||
def tx(self, tx_hash: str, rpc_endpoint: str, timeout: int = 10) -> CommandResult:
|
||||
def tx(self, tx_hash: str, rpc_endpoint: str, timeout: str = "10s") -> CommandResult:
|
||||
"""Query transaction status.
|
||||
|
||||
Args:
|
||||
|
@ -80,7 +80,7 @@ class NeoGoQuery(CliCommand):
|
|||
},
|
||||
)
|
||||
|
||||
def voter(self, rpc_endpoint: str, timeout: int = 10) -> CommandResult:
|
||||
def voter(self, rpc_endpoint: str, timeout: str = "10s") -> CommandResult:
|
||||
"""Print NEO holder account state.
|
||||
|
||||
Args:
|
||||
|
|
|
@ -27,14 +27,13 @@ class NeoGoWallet(CliCommand):
|
|||
Command's result.
|
||||
"""
|
||||
assert bool(wallet) ^ bool(wallet_config), self.WALLET_SOURCE_ERROR_MSG
|
||||
|
||||
exec_param = {
|
||||
param: param_value for param, param_value in locals().items() if param not in ["self"]
|
||||
}
|
||||
exec_param["timeout"] = f"{timeout}s"
|
||||
return self._execute(
|
||||
"wallet claim",
|
||||
**{
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
},
|
||||
**exec_param,
|
||||
)
|
||||
|
||||
def init(
|
||||
|
@ -293,14 +292,13 @@ class NeoGoWallet(CliCommand):
|
|||
Command's result.
|
||||
"""
|
||||
assert bool(wallet) ^ bool(wallet_config), self.WALLET_SOURCE_ERROR_MSG
|
||||
|
||||
exec_param = {
|
||||
param: param_value for param, param_value in locals().items() if param not in ["self"]
|
||||
}
|
||||
exec_param["timeout"] = f"{timeout}s"
|
||||
return self._execute(
|
||||
"wallet import-deployed",
|
||||
**{
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
},
|
||||
**exec_param,
|
||||
)
|
||||
|
||||
def remove(
|
||||
|
@ -337,9 +335,10 @@ class NeoGoWallet(CliCommand):
|
|||
self,
|
||||
input_file: str,
|
||||
address: str,
|
||||
rpc_endpoint: str,
|
||||
rpc_endpoint: Optional[str] = None,
|
||||
wallet: Optional[str] = None,
|
||||
wallet_config: Optional[str] = None,
|
||||
wallet_password: Optional[str] = None,
|
||||
out: Optional[str] = None,
|
||||
timeout: int = 10,
|
||||
) -> CommandResult:
|
||||
|
@ -356,6 +355,7 @@ class NeoGoWallet(CliCommand):
|
|||
wallet: Target location of the wallet file ('-' to read from stdin);
|
||||
conflicts with --wallet-config flag.
|
||||
wallet_config: Target location of the wallet config file; conflicts with --wallet flag.
|
||||
wallet_password: Wallet password.
|
||||
out: File to put JSON transaction to.
|
||||
input_file: File with JSON transaction.
|
||||
address: Address to use.
|
||||
|
@ -366,12 +366,16 @@ class NeoGoWallet(CliCommand):
|
|||
Command's result.
|
||||
"""
|
||||
assert bool(wallet) ^ bool(wallet_config), self.WALLET_SOURCE_ERROR_MSG
|
||||
exec_param = {
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self", "wallet_password"]
|
||||
}
|
||||
exec_param["timeout"] = f"{timeout}s"
|
||||
if wallet_password is not None:
|
||||
return self._execute_with_password("wallet sign", wallet_password, **exec_param)
|
||||
|
||||
return self._execute(
|
||||
"wallet sign",
|
||||
**{
|
||||
param: param_value
|
||||
for param, param_value in locals().items()
|
||||
if param not in ["self"]
|
||||
},
|
||||
)
|
||||
if wallet_config:
|
||||
return self._execute("wallet sign", **exec_param)
|
||||
|
||||
raise Exception(self.WALLET_PASSWD_ERROR_MSG)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue