forked from TrueCloudLab/frostfs-testlib
Add storagegroup, session and sign in neofs_cli lib
Signed-off-by: Vladimir Avdeev <v.avdeev@yadro.com>
This commit is contained in:
parent
b50c4cba7b
commit
9af8f89305
11 changed files with 290 additions and 37 deletions
|
@ -1,5 +1,3 @@
|
|||
from typing import List
|
||||
|
||||
from neofs_testlib.cli import NeoGo
|
||||
|
||||
|
||||
|
@ -14,8 +12,8 @@ class Multisig:
|
|||
contract_hash: str,
|
||||
contract_args: str,
|
||||
multisig_hash: str,
|
||||
wallets: List[str],
|
||||
passwords: List[str],
|
||||
wallets: list[str],
|
||||
passwords: list[str],
|
||||
address: str,
|
||||
endpoint: str,
|
||||
) -> None:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import json
|
||||
from time import sleep
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
|
||||
from cli import NeoGo
|
||||
from shell import Shell
|
||||
|
@ -24,7 +24,7 @@ class RoleDesignation:
|
|||
def set_notary_nodes(
|
||||
self,
|
||||
addr: str,
|
||||
pubkeys: List[str],
|
||||
pubkeys: list[str],
|
||||
script_hash: str,
|
||||
wallet: str,
|
||||
passwd: str,
|
||||
|
@ -47,7 +47,7 @@ class RoleDesignation:
|
|||
def set_inner_ring(
|
||||
self,
|
||||
addr: str,
|
||||
pubkeys: List[str],
|
||||
pubkeys: list[str],
|
||||
script_hash: str,
|
||||
wallet: str,
|
||||
passwd: str,
|
||||
|
@ -70,7 +70,7 @@ class RoleDesignation:
|
|||
def set_oracles(
|
||||
self,
|
||||
addr: str,
|
||||
pubkeys: List[str],
|
||||
pubkeys: list[str],
|
||||
script_hash: str,
|
||||
wallet: str,
|
||||
passwd: str,
|
||||
|
@ -92,10 +92,10 @@ class RoleDesignation:
|
|||
|
||||
def set_notary_nodes_multisig_tx(
|
||||
self,
|
||||
pubkeys: List[str],
|
||||
pubkeys: list[str],
|
||||
script_hash: str,
|
||||
wallets: List[str],
|
||||
passwords: List[str],
|
||||
wallets: list[str],
|
||||
passwords: list[str],
|
||||
address: str,
|
||||
endpoint: str,
|
||||
invoke_tx_file: str,
|
||||
|
@ -118,10 +118,10 @@ class RoleDesignation:
|
|||
|
||||
def set_inner_ring_multisig_tx(
|
||||
self,
|
||||
pubkeys: List[str],
|
||||
pubkeys: list[str],
|
||||
script_hash: str,
|
||||
wallets: List[str],
|
||||
passwords: List[str],
|
||||
wallets: list[str],
|
||||
passwords: list[str],
|
||||
address: str,
|
||||
endpoint: str,
|
||||
invoke_tx_file: str,
|
||||
|
@ -142,7 +142,7 @@ class RoleDesignation:
|
|||
)
|
||||
sleep(self.block_period)
|
||||
|
||||
def check_candidates(self, contract_hash: str, endpoint: str) -> Optional[List[str]]:
|
||||
def check_candidates(self, contract_hash: str, endpoint: str) -> Optional[list[str]]:
|
||||
out = self.neogo.contract.testinvokefunction(
|
||||
scripthash=contract_hash,
|
||||
method="innerRingCandidates",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import json
|
||||
import logging
|
||||
from typing import Any, Dict, List, Optional
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import requests
|
||||
|
||||
|
@ -29,8 +29,8 @@ class RPCClient:
|
|||
self,
|
||||
sc_hash: str,
|
||||
function: str,
|
||||
params: Optional[List] = None,
|
||||
signers: Optional[List] = None,
|
||||
params: Optional[list] = None,
|
||||
signers: Optional[list] = None,
|
||||
) -> Dict[str, Any]:
|
||||
return self._call_endpoint(
|
||||
"invokefunction", params=[sc_hash, function, params or [], signers or []]
|
||||
|
@ -75,6 +75,6 @@ class RPCClient:
|
|||
) from exc
|
||||
|
||||
|
||||
def _build_payload(method, params: Optional[List] = None):
|
||||
def _build_payload(method, params: Optional[list] = None):
|
||||
payload = json.dumps({"jsonrpc": "2.0", "method": method, "params": params or [], "id": 1})
|
||||
return payload.replace("'", '"')
|
||||
|
|
|
@ -17,6 +17,8 @@ class CliCommand:
|
|||
"doc_type": "type",
|
||||
"to_address": "to",
|
||||
"from_address": "from",
|
||||
"to_file": "to",
|
||||
"from_file": "from",
|
||||
}
|
||||
|
||||
def __init__(self, shell: Shell, cli_exec_path: str, **base_params):
|
||||
|
|
|
@ -5,6 +5,9 @@ from neofs_testlib.cli.neofs_cli.acl import NeofsCliACL
|
|||
from neofs_testlib.cli.neofs_cli.container import NeofsCliContainer
|
||||
from neofs_testlib.cli.neofs_cli.netmap import NeofsCliNetmap
|
||||
from neofs_testlib.cli.neofs_cli.object import NeofsCliObject
|
||||
from neofs_testlib.cli.neofs_cli.session import NeofsCliSession
|
||||
from neofs_testlib.cli.neofs_cli.storagegroup import NeofsCliStorageGroup
|
||||
from neofs_testlib.cli.neofs_cli.util import NeofsCliUtil
|
||||
from neofs_testlib.cli.neofs_cli.version import NeofsCliVersion
|
||||
from neofs_testlib.shell import Shell
|
||||
|
||||
|
@ -15,6 +18,9 @@ class NeofsCli:
|
|||
container: Optional[NeofsCliContainer] = None
|
||||
netmap: Optional[NeofsCliNetmap] = None
|
||||
object: Optional[NeofsCliObject] = None
|
||||
session: Optional[NeofsCliSession] = None
|
||||
storagegroup: Optional[NeofsCliStorageGroup] = None
|
||||
util: Optional[NeofsCliUtil] = None
|
||||
version: Optional[NeofsCliVersion] = None
|
||||
|
||||
def __init__(self, shell: Shell, neofs_cli_exec_path: str, config_file: Optional[str] = None):
|
||||
|
@ -23,4 +29,7 @@ class NeofsCli:
|
|||
self.container = NeofsCliContainer(shell, neofs_cli_exec_path, config=config_file)
|
||||
self.netmap = NeofsCliNetmap(shell, neofs_cli_exec_path, config=config_file)
|
||||
self.object = NeofsCliObject(shell, neofs_cli_exec_path, config=config_file)
|
||||
self.session = NeofsCliSession(shell, neofs_cli_exec_path, config=config_file)
|
||||
self.storagegroup = NeofsCliStorageGroup(shell, neofs_cli_exec_path, config=config_file)
|
||||
self.util = NeofsCliUtil(shell, neofs_cli_exec_path, config=config_file)
|
||||
self.version = NeofsCliVersion(shell, neofs_cli_exec_path, config=config_file)
|
||||
|
|
|
@ -42,7 +42,7 @@ class NeofsCliContainer(CliCommand):
|
|||
subnet: String representation of container subnetwork.
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
@ -77,7 +77,7 @@ class NeofsCliContainer(CliCommand):
|
|||
session: Path to a JSON-encoded container session token.
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
@ -112,7 +112,7 @@ class NeofsCliContainer(CliCommand):
|
|||
to: Path to dump encoded container.
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
@ -146,7 +146,7 @@ class NeofsCliContainer(CliCommand):
|
|||
session: Path to a JSON-encoded container session token.
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
@ -176,7 +176,7 @@ class NeofsCliContainer(CliCommand):
|
|||
rpc_endpoint: Remote node address (as 'multiaddr' or '<host>:<port>').
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
@ -204,7 +204,7 @@ class NeofsCliContainer(CliCommand):
|
|||
rpc_endpoint: Remote node address (as 'multiaddr' or '<host>:<port>').
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
@ -239,7 +239,7 @@ class NeofsCliContainer(CliCommand):
|
|||
table: Path to file with JSON or binary encoded EACL table.
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
|
|
@ -23,7 +23,7 @@ class NeofsCliNetmap(CliCommand):
|
|||
rpc_endpoint: Remote node address (as 'multiaddr' or '<host>:<port>').
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: Path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
@ -81,7 +81,7 @@ class NeofsCliNetmap(CliCommand):
|
|||
rpc_endpoint: Remote node address (as 'multiaddr' or '<host>:<port>').
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: Path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
@ -109,7 +109,7 @@ class NeofsCliNetmap(CliCommand):
|
|||
rpc_endpoint: Remote node address (as 'multiaddr' or '<host>:<port>').
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: Path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
|
|
@ -29,7 +29,7 @@ class NeofsCliObject(CliCommand):
|
|||
session: Path to a JSON-encoded container session token.
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
@ -71,7 +71,7 @@ class NeofsCliObject(CliCommand):
|
|||
session: Path to a JSON-encoded container session token.
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
@ -109,7 +109,7 @@ class NeofsCliObject(CliCommand):
|
|||
ttl: TTL value in request meta header (default 2).
|
||||
hash_type: Hash type. Either 'sha256' or 'tz' (default "sha256").
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
@ -155,7 +155,7 @@ class NeofsCliObject(CliCommand):
|
|||
session: Path to a JSON-encoded container session token.
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
@ -191,7 +191,7 @@ class NeofsCliObject(CliCommand):
|
|||
session: Path to a JSON-encoded container session token.
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
@ -238,7 +238,7 @@ class NeofsCliObject(CliCommand):
|
|||
session: Path to a JSON-encoded container session token.
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
@ -280,7 +280,7 @@ class NeofsCliObject(CliCommand):
|
|||
session: Path to a JSON-encoded container session token.
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
@ -320,7 +320,7 @@ class NeofsCliObject(CliCommand):
|
|||
session: Path to a JSON-encoded container session token.
|
||||
ttl: TTL value in request meta header (default 2).
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Request X-Headers in form of Key=Value.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
|
|
41
src/neofs_testlib/cli/neofs_cli/session.py
Normal file
41
src/neofs_testlib/cli/neofs_cli/session.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
from typing import Optional
|
||||
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeofsCliSession(CliCommand):
|
||||
def create(
|
||||
self,
|
||||
rpc_endpoint: str,
|
||||
wallet: str,
|
||||
wallet_password: str,
|
||||
out: str,
|
||||
lifetime: Optional[int] = None,
|
||||
address: Optional[str] = None,
|
||||
json: Optional[bool] = False,
|
||||
) -> CommandResult:
|
||||
"""
|
||||
Create session token.
|
||||
|
||||
Args:
|
||||
address: Address of wallet account.
|
||||
out: File to write session token to.
|
||||
lifetime: Number of epochs for token to stay valid.
|
||||
json: Output token in JSON.
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
wallet_password: Wallet password.
|
||||
rpc_endpoint: Remote node address (as 'multiaddr' or '<host>:<port>').
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
"""
|
||||
return self._execute_with_password(
|
||||
"session create",
|
||||
wallet_password,
|
||||
**{
|
||||
param: value
|
||||
for param, value in locals().items()
|
||||
if param not in ["self", "wallet_password"]
|
||||
},
|
||||
)
|
147
src/neofs_testlib/cli/neofs_cli/storagegroup.py
Normal file
147
src/neofs_testlib/cli/neofs_cli/storagegroup.py
Normal file
|
@ -0,0 +1,147 @@
|
|||
from typing import Optional
|
||||
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeofsCliStorageGroup(CliCommand):
|
||||
def put(
|
||||
self,
|
||||
rpc_endpoint: str,
|
||||
wallet: str,
|
||||
cid: str,
|
||||
members: list[str],
|
||||
ttl: Optional[int] = None,
|
||||
bearer: Optional[str] = None,
|
||||
lifetime: Optional[int] = None,
|
||||
address: Optional[str] = None,
|
||||
xhdr: Optional[dict] = None,
|
||||
) -> CommandResult:
|
||||
"""
|
||||
Put storage group to NeoFS.
|
||||
|
||||
Args:
|
||||
address: Address of wallet account.
|
||||
bearer: File with signed JSON or binary encoded bearer token.
|
||||
cid: Container ID.
|
||||
members: ID list of storage group members.
|
||||
lifetime: Storage group lifetime in epochs.
|
||||
rpc_endpoint: Remote node address (as 'multiaddr' or '<host>:<port>').
|
||||
ttl: TTL value in request meta header.
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
"""
|
||||
members = ",".join(members)
|
||||
return self._execute(
|
||||
"storagegroup put",
|
||||
**{param: value for param, value in locals().items() if param not in ["self"]},
|
||||
)
|
||||
|
||||
def get(
|
||||
self,
|
||||
rpc_endpoint: str,
|
||||
wallet: str,
|
||||
cid: str,
|
||||
id: str,
|
||||
raw: Optional[bool] = False,
|
||||
ttl: Optional[int] = None,
|
||||
bearer: Optional[str] = None,
|
||||
lifetime: Optional[int] = None,
|
||||
address: Optional[str] = None,
|
||||
xhdr: Optional[dict] = None,
|
||||
) -> CommandResult:
|
||||
"""
|
||||
Get storage group from NeoFS.
|
||||
|
||||
Args:
|
||||
address: Address of wallet account.
|
||||
bearer: File with signed JSON or binary encoded bearer token.
|
||||
cid: Container ID.
|
||||
id: Storage group identifier.
|
||||
raw: Set raw request option.
|
||||
lifetime: Storage group lifetime in epochs.
|
||||
rpc_endpoint: Remote node address (as 'multiaddr' or '<host>:<port>').
|
||||
ttl: TTL value in request meta header.
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
"""
|
||||
return self._execute(
|
||||
"storagegroup get",
|
||||
**{param: value for param, value in locals().items() if param not in ["self"]},
|
||||
)
|
||||
|
||||
def list(
|
||||
self,
|
||||
rpc_endpoint: str,
|
||||
wallet: str,
|
||||
cid: str,
|
||||
raw: Optional[bool] = False,
|
||||
ttl: Optional[int] = None,
|
||||
bearer: Optional[str] = None,
|
||||
lifetime: Optional[int] = None,
|
||||
address: Optional[str] = None,
|
||||
xhdr: Optional[dict] = None,
|
||||
) -> CommandResult:
|
||||
"""
|
||||
List storage groups in NeoFS container.
|
||||
|
||||
Args:
|
||||
address: Address of wallet account.
|
||||
bearer: File with signed JSON or binary encoded bearer token.
|
||||
cid: Container ID.
|
||||
raw: Set raw request option.
|
||||
lifetime: Storage group lifetime in epochs.
|
||||
rpc_endpoint: Remote node address (as 'multiaddr' or '<host>:<port>').
|
||||
ttl: TTL value in request meta header.
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
"""
|
||||
return self._execute(
|
||||
"storagegroup list",
|
||||
**{param: value for param, value in locals().items() if param not in ["self"]},
|
||||
)
|
||||
|
||||
def delete(
|
||||
self,
|
||||
rpc_endpoint: str,
|
||||
wallet: str,
|
||||
cid: str,
|
||||
id: str,
|
||||
raw: Optional[bool] = False,
|
||||
ttl: Optional[int] = None,
|
||||
bearer: Optional[str] = None,
|
||||
lifetime: Optional[int] = None,
|
||||
address: Optional[str] = None,
|
||||
xhdr: Optional[dict] = None,
|
||||
) -> CommandResult:
|
||||
"""
|
||||
Delete storage group from NeoFS.
|
||||
|
||||
Args:
|
||||
address: Address of wallet account.
|
||||
bearer: File with signed JSON or binary encoded bearer token.
|
||||
cid: Container ID.
|
||||
id: Storage group identifier.
|
||||
raw: Set raw request option.
|
||||
lifetime: Storage group lifetime in epochs.
|
||||
rpc_endpoint: Remote node address (as 'multiaddr' or '<host>:<port>').
|
||||
ttl: TTL value in request meta header.
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
xhdr: Dict with request X-Headers.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
"""
|
||||
return self._execute(
|
||||
"storagegroup delete",
|
||||
**{param: value for param, value in locals().items() if param not in ["self"]},
|
||||
)
|
56
src/neofs_testlib/cli/neofs_cli/util.py
Normal file
56
src/neofs_testlib/cli/neofs_cli/util.py
Normal file
|
@ -0,0 +1,56 @@
|
|||
from typing import Optional
|
||||
|
||||
from neofs_testlib.cli.cli_command import CliCommand
|
||||
from neofs_testlib.shell import CommandResult
|
||||
|
||||
|
||||
class NeofsCliUtil(CliCommand):
|
||||
def sign_bearer_token(
|
||||
self,
|
||||
wallet: str,
|
||||
from_file: str,
|
||||
to_file: str,
|
||||
address: Optional[str] = None,
|
||||
json: Optional[bool] = False,
|
||||
) -> CommandResult:
|
||||
"""
|
||||
Sign bearer token to use it in requests.
|
||||
|
||||
Args:
|
||||
address: Address of wallet account.
|
||||
from_file: File with JSON or binary encoded bearer token to sign.
|
||||
to_file: File to dump signed bearer token (default: binary encoded).
|
||||
json: Dump bearer token in JSON encoding.
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
"""
|
||||
return self._execute(
|
||||
"util sign bearer-token",
|
||||
**{param: value for param, value in locals().items() if param not in ["self"]},
|
||||
)
|
||||
|
||||
def sign_session_token(
|
||||
self,
|
||||
wallet: str,
|
||||
from_file: str,
|
||||
to_file: str,
|
||||
address: Optional[str] = None,
|
||||
) -> CommandResult:
|
||||
"""
|
||||
Sign session token to use it in requests.
|
||||
|
||||
Args:
|
||||
address: Address of wallet account.
|
||||
from_file: File with JSON encoded session token to sign.
|
||||
to_file: File to dump signed bearer token (default: binary encoded).
|
||||
wallet: WIF (NEP-2) string or path to the wallet or binary key.
|
||||
|
||||
Returns:
|
||||
Command's result.
|
||||
"""
|
||||
return self._execute(
|
||||
"util sign session-token",
|
||||
**{param: value for param, value in locals().items() if param not in ["self"]},
|
||||
)
|
Loading…
Reference in a new issue