Skip to content

Commit

Permalink
Merge pull request #45 from Hipo/handle-assets-without-names
Browse files Browse the repository at this point in the history
Bugfix for fetching assets without a unit name
  • Loading branch information
fergalwalsh authored Dec 20, 2022
2 parents 7b1cdc0 + 3387ffe commit cd1a7db
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tinyman/assets.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from dataclasses import dataclass
from decimal import Decimal
from typing import Optional

@dataclass
class Asset:
id: int
name: str = None
unit_name: str = None
name: Optional[str] = None
unit_name: Optional[str] = None
decimals: int = None

def __call__(self, amount: int) -> "AssetAmount":
Expand All @@ -23,8 +24,8 @@ def fetch(self, algod):
'unit-name': 'ALGO',
'decimals': 6,
}
self.name = params.get('name', '')
self.unit_name = params.get('unit-name', '')
self.name = params.get('name')
self.unit_name = params.get('unit-name')
self.decimals = params['decimals']
return self

Expand Down

0 comments on commit cd1a7db

Please sign in to comment.