-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathconftest.py
44 lines (33 loc) · 1.34 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Copyright (c) The Diem Core Contributors
# SPDX-License-Identifier: Apache-2.0
from diem import testnet, offchain, identifier
from diem.testing import LocalAccount
import pytest
@pytest.fixture
def factory():
return Factory()
class Factory:
def hrp(self) -> str:
return identifier.TDM
def create_offchain_client(self, account, client):
return offchain.Client(account.account_address, client, self.hrp())
def new_payment_object(self, sender=LocalAccount.generate(), receiver=LocalAccount.generate()):
amount = 1_000_000_000_000
currency = testnet.TEST_CURRENCY_CODE
sender_account_id = sender.account_identifier(identifier.gen_subaddress())
sender_kyc_data = offchain.individual_kyc_data(
given_name="Jack",
surname="G",
address=offchain.AddressObject(city="San Francisco"),
)
receiver_account_id = receiver.account_identifier(identifier.gen_subaddress())
return offchain.new_payment_object(
sender_account_id,
sender_kyc_data,
receiver_account_id,
amount,
currency,
)
def new_sender_payment_command(self):
payment = self.new_payment_object()
return offchain.PaymentCommand(my_actor_address=payment.sender.address, payment=payment, inbound=False)