Exemple #1
0
 def init_lp(cls, app_logger=None):
     global logger
     if app_logger:
         logger = app_logger
     logger.info("Custody init")
     Custody.init(CHAIN_ID)
     logger.info("Configure and create storage")
     storage.configure_storage()
     storage.create_storage()
Exemple #2
0
def init_test_onchainwallet(monkeypatch):
    monkeypatch.setenv("WALLET_CUSTODY_ACCOUNT_NAME", "test_wallet")
    monkeypatch.setenv("LIQUIDITY_CUSTODY_ACCOUNT_NAME", "test_liq")
    monkeypatch.setenv(
        "CUSTODY_PRIVATE_KEYS",
        json.dumps({
            "test_wallet": FAKE_WALLET_PRIVATE_KEY,
            "test_liq": FAKE_LIQUIDITY_PRIVATE_KEY,
        }),
    )

    Custody.init(CHAIN_ID)
def init_onchain_account(custody_private_keys, account_name,
                         account: LocalAccount, base_url, compliance_key,
                         chain_id: int):
    account_addr = utils.account_address_hex(account.account_address)
    print(
        f'Creating and initialize blockchain account {account_name} @ {account_addr}'
    )
    os.environ["CUSTODY_PRIVATE_KEYS"] = custody_private_keys
    Custody.init(diem_types.ChainId.from_int(chain_id))
    vasp = Vasp(diem_client, account_name)
    vasp.setup_blockchain(base_url, compliance_key)
    print(f'Account initialization done!')

    return vasp
    def __init__(
        self,
        diem_client: DiemClient,
        custody_account_name: Optional[str] = _DEFAULT_ACCOUNT_NAME,
    ):
        self._diem_client = diem_client
        self._custody: Custody = Custody()
        self._custody_account_name = custody_account_name

        self.account = self._custody.get_account(custody_account_name)
        self.address_str = utils.account_address_hex(self.account.account_address)