Skip to content

Commit

Permalink
Update diem ID to work with move resource name changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SunMi Lee authored and Xiao Li committed Jul 15, 2021
1 parent b390850 commit 5f51508
Show file tree
Hide file tree
Showing 18 changed files with 655 additions and 350 deletions.
2 changes: 1 addition & 1 deletion diem
Submodule diem updated 1501 files
2 changes: 1 addition & 1 deletion src/diem/jsonrpc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
EVENT_DATA_BASE_URL_ROTATION,
EVENT_DATA_CREATE_ACCOUNT,
EVENT_DATA_ADMIN_TRANSACTION,
EVENT_DATA_DIEM_ID_DOMAIN,
EVENT_DATA_VASP_DOMAIN,
# VMStatus#type field values
VM_STATUS_EXECUTED,
VM_STATUS_OUT_OF_GAS,
Expand Down
6 changes: 3 additions & 3 deletions src/diem/jsonrpc/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,11 @@ async def get_account_state_with_proof(
"get_account_state_with_proof", params, _parse_obj(lambda: rpc.AccountStateWithProof())
)

async def get_diem_id_domain_map(self, batch_size: int = 100) -> typing.Dict[str, str]:
async def get_vasp_domain_map(self, batch_size: int = 100) -> typing.Dict[str, str]:
domain_map = {}
event_index = 0
tc_account = await self.must_get_account(TREASURY_ADDRESS)
event_stream_key = tc_account.role.diem_id_domain_events_key
event_stream_key = tc_account.role.vasp_domain_events_key
while True:
events = await self.get_events(event_stream_key, event_index, batch_size)
for event in events:
Expand All @@ -395,7 +395,7 @@ async def get_diem_id_domain_map(self, batch_size: int = 100) -> typing.Dict[str

async def support_diem_id(self) -> bool:
tc_account = await self.must_get_account(TREASURY_ADDRESS)
return bool(tc_account.role.diem_id_domain_events_key)
return bool(tc_account.role.vasp_domain_events_key)

async def submit(
self,
Expand Down
6 changes: 3 additions & 3 deletions src/diem/jsonrpc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,11 @@ def get_account_state_with_proof(
params = [address, version, ledger_version]
return self.execute("get_account_state_with_proof", params, _parse_obj(lambda: rpc.AccountStateWithProof()))

def get_diem_id_domain_map(self, batch_size: int = 100) -> typing.Dict[str, str]:
def get_vasp_domain_map(self, batch_size: int = 100) -> typing.Dict[str, str]:
domain_map = {}
event_index = 0
tc_account = self.must_get_account(utils.account_address(TREASURY_ADDRESS))
event_stream_key = tc_account.role.diem_id_domain_events_key
event_stream_key = tc_account.role.vasp_domain_events_key
while True:
events = self.get_events(event_stream_key, event_index, batch_size)
for event in events:
Expand All @@ -401,7 +401,7 @@ def get_diem_id_domain_map(self, batch_size: int = 100) -> typing.Dict[str, str]

def support_diem_id(self) -> bool:
tc_account = self.must_get_account(TREASURY_ADDRESS)
return bool(tc_account.role.diem_id_domain_events_key)
return bool(tc_account.role.vasp_domain_events_key)

def submit(
self,
Expand Down
2 changes: 1 addition & 1 deletion src/diem/jsonrpc/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
EVENT_DATA_BASE_URL_ROTATION: str = "baseurlrotation"
EVENT_DATA_CREATE_ACCOUNT: str = "createaccount"
EVENT_DATA_ADMIN_TRANSACTION: str = "admintransaction"
EVENT_DATA_DIEM_ID_DOMAIN: str = "diemiddomain"
EVENT_DATA_VASP_DOMAIN: str = "vaspdomain"


# VMStatus#type field values
Expand Down
201 changes: 165 additions & 36 deletions src/diem/jsonrpc/jsonrpc_pb2.py

Large diffs are not rendered by default.

71 changes: 63 additions & 8 deletions src/diem/jsonrpc/jsonrpc_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ class AccountRole(google___protobuf___message___Message):
base_url_rotation_events_key: typing___Text = ...
num_children: builtin___int = ...
received_mint_events_key: typing___Text = ...
diem_id_domains: google___protobuf___internal___containers___RepeatedScalarFieldContainer[typing___Text] = ...
diem_id_domain_events_key: typing___Text = ...
vasp_domains: google___protobuf___internal___containers___RepeatedScalarFieldContainer[typing___Text] = ...
vasp_domain_events_key: typing___Text = ...
@property
def preburn_balances(
self,
Expand All @@ -149,8 +149,8 @@ class AccountRole(google___protobuf___message___Message):
received_mint_events_key: typing___Optional[typing___Text] = None,
preburn_balances: typing___Optional[typing___Iterable[type___Amount]] = None,
preburn_queues: typing___Optional[typing___Iterable[type___PreburnQueue]] = None,
diem_id_domains: typing___Optional[typing___Iterable[typing___Text]] = None,
diem_id_domain_events_key: typing___Optional[typing___Text] = None,
vasp_domains: typing___Optional[typing___Iterable[typing___Text]] = None,
vasp_domain_events_key: typing___Optional[typing___Text] = None,
) -> None: ...
def ClearField(
self,
Expand All @@ -163,10 +163,6 @@ class AccountRole(google___protobuf___message___Message):
b"compliance_key",
"compliance_key_rotation_events_key",
b"compliance_key_rotation_events_key",
"diem_id_domain_events_key",
b"diem_id_domain_events_key",
"diem_id_domains",
b"diem_id_domains",
"expiration_time",
b"expiration_time",
"human_name",
Expand All @@ -183,6 +179,10 @@ class AccountRole(google___protobuf___message___Message):
b"received_mint_events_key",
"type",
b"type",
"vasp_domain_events_key",
b"vasp_domain_events_key",
"vasp_domains",
b"vasp_domains",
],
) -> None: ...

Expand Down Expand Up @@ -826,3 +826,58 @@ class AccumulatorConsistencyProof(google___protobuf___message___Message):
) -> None: ...

type___AccumulatorConsistencyProof = AccumulatorConsistencyProof

class AccountTransactionsWithProof(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
serialized_txns_with_proofs: google___protobuf___internal___containers___RepeatedScalarFieldContainer[
typing___Text
] = ...
def __init__(
self,
*,
serialized_txns_with_proofs: typing___Optional[typing___Iterable[typing___Text]] = None,
) -> None: ...
def ClearField(
self, field_name: typing_extensions___Literal["serialized_txns_with_proofs", b"serialized_txns_with_proofs"]
) -> None: ...

type___AccountTransactionsWithProof = AccountTransactionsWithProof

class EventWithProof(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
event_with_proof: typing___Text = ...
def __init__(
self,
*,
event_with_proof: typing___Optional[typing___Text] = None,
) -> None: ...
def ClearField(self, field_name: typing_extensions___Literal["event_with_proof", b"event_with_proof"]) -> None: ...

type___EventWithProof = EventWithProof

class EventByVersionWithProof(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
@property
def lower_bound_incl(self) -> type___EventWithProof: ...
@property
def upper_bound_excl(self) -> type___EventWithProof: ...
def __init__(
self,
*,
lower_bound_incl: typing___Optional[type___EventWithProof] = None,
upper_bound_excl: typing___Optional[type___EventWithProof] = None,
) -> None: ...
def HasField(
self,
field_name: typing_extensions___Literal[
"lower_bound_incl", b"lower_bound_incl", "upper_bound_excl", b"upper_bound_excl"
],
) -> builtin___bool: ...
def ClearField(
self,
field_name: typing_extensions___Literal[
"lower_bound_incl", b"lower_bound_incl", "upper_bound_excl", b"upper_bound_excl"
],
) -> None: ...

type___EventByVersionWithProof = EventByVersionWithProof
Loading

0 comments on commit 5f51508

Please sign in to comment.