Skip to content

Commit 09a4257

Browse files
author
Xiao Li
authored
Merge pull request #9 from novifinancial/fix
upgrade to latest testnet, fix account role missing fields
2 parents ff6357b + f213dda commit 09a4257

File tree

11 files changed

+1731
-297
lines changed

11 files changed

+1731
-297
lines changed

libra

Submodule libra updated from 001cda3 to 0102f6f

python/codegen.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LIBRA=../libra
88

99
# Add transaction builders
1010
(cd "$LIBRA" && cargo build -p transaction-builder-generator)
11-
"$LIBRA/target/debug/transaction-builder-generator"\
11+
"$LIBRA/target/debug/generate-transaction-builders"\
1212
--language python3\
1313
--module-name stdlib\
1414
--with-libra-types "$LIBRA/testsuite/generate-format/tests/staged/libra.yaml"\

python/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def run(self):
7676
setup(
7777
name="pylibra-beta",
7878
# change to 0.1.YYYYMMDDNN on release
79-
version="0.5.master",
79+
version="0.5.2020091001",
8080
description="",
8181
python_requires=">=3.7",
8282
packages=find_packages("src"),

python/src/pylibra/_jsonrpc_transport.py

+7-11
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class GetAccountStateResp:
4444
balances: typing.List[typing.Dict]
4545
sent_events_key: str
4646
received_events_key: str
47-
role: typing.Union[str, typing.Dict]
47+
role: typing.Dict[str, typing.Any]
4848
is_frozen: bool
4949

5050

@@ -160,7 +160,7 @@ def metadata(self) -> bytes:
160160
return bytes.fromhex(self._transaction["script"]["metadata"]) if self.is_p2p else b""
161161

162162
@property
163-
def vm_status(self) -> int:
163+
def vm_status(self) -> typing.Dict[str, typing.Any]:
164164
return self._result["vm_status"]
165165

166166

@@ -178,15 +178,11 @@ def __init__(self, address_hex: str, state: GetAccountStateResp):
178178
for balance_dict in self._state.balances:
179179
self._balances[balance_dict["currency"]] = balance_dict["amount"]
180180

181-
if type(self._state.role) == str:
182-
# For strings returned like "empty", "unknown"
183-
self._role = typing.cast(str, self._state.role)
184-
else:
185-
role_dict = typing.cast(typing.Dict, self._state.role)
186-
if self._state.role["type"] == "parent_vasp":
187-
self._role = ParentVASP(**(role_dict))
188-
elif self._state.role["type"] == "child_vasp":
189-
self._role = ChildVASP(**(role_dict))
181+
role_dict = typing.cast(typing.Dict, self._state.role)
182+
if self._state.role["type"] == "parent_vasp":
183+
self._role = ParentVASP(**(role_dict))
184+
elif self._state.role["type"] == "child_vasp":
185+
self._role = ChildVASP(**(role_dict))
190186

191187
@property
192188
def address(self) -> bytes:

python/src/pylibra/_transport.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def transactions_by_range(
5555

5656
def transaction_by_acc_seq(
5757
self, addr_hex: str, seq: int, include_events: bool = False
58-
) -> typing.Tuple[typing.Optional[SignedTransaction], typing.List[typing.Union[Event, PaymentEvent]],]:
58+
) -> typing.Tuple[typing.Optional[SignedTransaction], typing.List[typing.Union[Event, PaymentEvent]]]:
5959
raise NotImplementedError()
6060

6161
def get_events(self, key_hex: str, start: int, limit: int) -> typing.List[typing.Union[Event, PaymentEvent]]:

python/src/pylibra/_types.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class ParentVASP:
1515
expiration_time: int
1616
human_name: str
1717
num_children: int
18+
base_url_rotation_events_key: str
19+
compliance_key_rotation_events_key: str
1820

1921

2022
@dataclasses.dataclass
@@ -176,7 +178,7 @@ def metadata(self) -> bytes:
176178

177179
@property
178180
@abstractmethod
179-
def vm_status(self) -> int:
181+
def vm_status(self) -> typing.Dict[str, typing.Any]:
180182
raise NotImplementedError()
181183

182184

python/src/pylibra/lcs/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ def serialize(obj: typing.Any, obj_type) -> bytes:
209209
if not dataclasses.is_dataclass(obj_type):
210210
raise ValueError("Unexpected type", obj_type)
211211

212+
# pyre-ignore
212213
if not isinstance(obj, obj_type):
213214
raise ValueError("Wrong Value for the type", obj, obj_type)
214215

0 commit comments

Comments
 (0)