Skip to content

Commit

Permalink
[Python SDK] Use AccountAddress.from_str_relaxed when parsing address…
Browse files Browse the repository at this point in the history
…es from the node API
  • Loading branch information
banool authored and Poytr1 committed Oct 4, 2023
1 parent c1a3042 commit 5c35b2a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ecosystem/python/sdk/aptos_sdk/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def load(path: str) -> Account:
with open(path) as file:
data = json.load(file)
return Account(
AccountAddress.from_str(data["account_address"]),
AccountAddress.from_str_relaxed(data["account_address"]),
ed25519.PrivateKey.from_str(data["private_key"]),
)

Expand Down
10 changes: 5 additions & 5 deletions ecosystem/python/sdk/aptos_sdk/aptos_token_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, allow_ungated_transfer, owner):
def parse(resource: dict[str, Any]) -> Object:
return Object(
resource["allow_ungated_transfer"],
AccountAddress.from_str(resource["owner"]),
AccountAddress.from_str_relaxed(resource["owner"]),
)

def __str__(self) -> str:
Expand All @@ -54,7 +54,7 @@ def __str__(self) -> str:
@staticmethod
def parse(resource: dict[str, Any]) -> Collection:
return Collection(
AccountAddress.from_str(resource["creator"]),
AccountAddress.from_str_relaxed(resource["creator"]),
resource["description"],
resource["name"],
resource["uri"],
Expand All @@ -81,7 +81,7 @@ def parse(resource: dict[str, Any]) -> Royalty:
return Royalty(
resource["numerator"],
resource["denominator"],
AccountAddress.from_str(resource["payee_address"]),
AccountAddress.from_str_relaxed(resource["payee_address"]),
)


Expand Down Expand Up @@ -114,7 +114,7 @@ def __str__(self) -> str:
@staticmethod
def parse(resource: dict[str, Any]):
return Token(
AccountAddress.from_str(resource["collection"]["inner"]),
AccountAddress.from_str_relaxed(resource["collection"]["inner"]),
int(resource["index"]),
resource["description"],
resource["name"],
Expand Down Expand Up @@ -626,5 +626,5 @@ async def tokens_minted_from_transaction(
for event in output["events"]:
if event["type"] != "0x4::collection::MintEvent":
continue
mints.append(AccountAddress.from_str(event["data"]["token"]))
mints.append(AccountAddress.from_str_relaxed(event["data"]["token"]))
return mints
2 changes: 1 addition & 1 deletion ecosystem/python/sdk/examples/rotate_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async def rotate_auth_key_ed_25519_payload(
from_account.address()
),
originator=from_account.address(),
current_auth_key=AccountAddress.from_str(from_account.auth_key()),
current_auth_key=AccountAddress.from_str_relaxed(from_account.auth_key()),
new_public_key=to_account.public_key().key.encode(),
)

Expand Down

0 comments on commit 5c35b2a

Please sign in to comment.