Skip to content

Commit

Permalink
feat(keystore_and_bump): Typecheck sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
akhercha committed Jul 23, 2024
1 parent 470826a commit 040305b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions pragma-sdk/pragma_sdk/common/types/currency.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@ def __init__(
ethereum_address: Optional[Address] = None,
):
self.id = currency_id

self.decimals = decimals

if isinstance(is_abstract_currency, int):
is_abstract_currency = bool(is_abstract_currency)
self.is_abstract_currency = is_abstract_currency

if starknet_address is None:
starknet_address = 0
self.starknet_address = starknet_address
self.starknet_address = self._validate_address(starknet_address)
self.ethereum_address = self._validate_address(ethereum_address)

if ethereum_address is None:
ethereum_address = 0
self.ethereum_address = ethereum_address
def _validate_address(self, address: Optional[Address]) -> int:
if address is None:
return 0
if isinstance(address, str):
return int(address, 16)
return address

@classmethod
def from_asset_config(cls, config: AssetConfig) -> Self:
Expand Down
2 changes: 1 addition & 1 deletion pragma-sdk/pragma_sdk/common/types/types.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from enum import StrEnum, unique
from typing import Dict

Address = int | str
Address = int
HexStr = str
Decimals = int
UnixTimestamp = int
Expand Down

0 comments on commit 040305b

Please sign in to comment.