|
33 | 33 | from ...prim import ContractData, ContractId, Party, datetime_to_timestamp, to_parties |
34 | 34 | from ...query import Filter, Queries, Query, parse_query |
35 | 35 | from .._offsets import END, End, LedgerOffsetRange, from_offset_until_forever |
| 36 | +from .._retry import retry |
36 | 37 | from ..api_types import ( |
37 | 38 | ActAs, |
38 | 39 | Admin, |
|
50 | 51 | Version, |
51 | 52 | ) |
52 | 53 | from ..config import Config |
53 | | -from ..config.access import PropertyBasedAccessConfig, TokenBasedAccessConfig |
| 54 | +from ..config.access import TokenBasedAccessConfig |
54 | 55 | from ..errors import ProtocolWarning, _allow_cancel, _translate_exceptions |
55 | 56 | from .channel import create_channel |
56 | 57 | from .codec_aio import Codec |
@@ -110,8 +111,10 @@ async def open(self) -> None: |
110 | 111 | for right in await self.list_user_rights(): |
111 | 112 | if right == Admin: |
112 | 113 | admin = True |
113 | | - elif isinstance(right, (ReadAs, ActAs)): |
| 114 | + elif isinstance(right, ReadAs): |
114 | 115 | read_as.append(right.party) |
| 116 | + elif isinstance(right, ActAs): |
| 117 | + act_as.append(right.party) |
115 | 118 |
|
116 | 119 | # noinspection PyProtectedMember |
117 | 120 | cast(TokenBasedAccessConfig, self._config.access)._set( |
@@ -512,7 +515,7 @@ def _submit_and_wait_request( |
512 | 515 | # this is support for versions of Daml Connect prior to 1.9.0 |
513 | 516 | act_as = meta.act_as |
514 | 517 | if act_as is not None: |
515 | | - act_as_party = act_as[0] |
| 518 | + act_as_party = act_as[0] if act_as else None |
516 | 519 | else: |
517 | 520 | raise ValueError("current access rights do not include any act-as parties") |
518 | 521 |
|
@@ -748,7 +751,8 @@ async def allocate_party( |
748 | 751 | party_id_hint=Party(identifier_hint) if identifier_hint else None, |
749 | 752 | display_name=display_name, |
750 | 753 | ) |
751 | | - response = await stub.AllocateParty(request) |
| 754 | + |
| 755 | + response = await retry(lambda: stub.AllocateParty(request)) |
752 | 756 | return Codec.decode_party_info(response.party_details) |
753 | 757 |
|
754 | 758 | async def list_known_parties(self) -> Sequence[PartyInfo]: |
|
0 commit comments