コード例 #1
0
def test_send_ping_command(
    stub_config: AppConfig,
    target_client: RestClient,
    stub_client: RestClient,
    diem_client: jsonrpc.Client,
    hrp: str,
) -> None:
    """
    Test Plan:
    1. Create a new test account in the target wallet application.
    2. Generate a new account identifier from the new test account.
    3. Send a ping command request to the generated account identifier.
    4. Expect response status is success, and response cid is same with request cid.
    5. Send another ping command request to the generated account identifier.
    6. Expect response status is success.
    7. Expect cid is different for the 2 response status.
    """

    receiver_address = target_client.create_account().generate_account_identifier()
    offchain_client = offchain.Client(stub_config.account.account_address, diem_client, hrp)
    cid = str(uuid.uuid4())
    resp = offchain_client.ping(receiver_address, stub_config.account.compliance_key.sign, cid=cid)
    assert resp.cid == cid
    assert resp.status == "success"
    assert resp.error is None

    resp2 = offchain_client.ping(receiver_address, stub_config.account.compliance_key.sign)
    assert resp2.cid
    assert resp2.status == "success"
    assert resp2.error is None

    assert resp.cid != resp2.cid
コード例 #2
0
ファイル: wallet.py プロジェクト: xli/client-sdk-python
 def __post_init__(self) -> None:
     self.compliance_key = self.parent_vasp.compliance_key
     self.offchain_client = offchain.Client(
         self.parent_vasp.account_address,
         self.jsonrpc_client,
         self.hrp,
         supported_currency_codes=[testnet.TEST_CURRENCY_CODE],
     )
コード例 #3
0
ファイル: context.py プロジェクト: CapCap/reference-wallet
 def __post_init__(self) -> None:
     self.offchain_client = offchain.Client(
         self.config.vasp_account_address(),
         self.jsonrpc_client,
         self.config.diem_address_hrp(),
     )
コード例 #4
0
 def create_offchain_client(self, account, client):
     return offchain.Client(account.account_address, client, self.hrp())
コード例 #5
0
ファイル: wallet.py プロジェクト: MarcelintoSpace/diem-wallet
 def __post_init__(self) -> None:
     self.compliance_key = self.parent_vasp.compliance_key
     self.offchain_client = offchain.Client(self.parent_vasp.account_address, self.jsonrpc_client, self.hrp)