diff --git a/mmgen/swap/asset.py b/mmgen/swap/asset.py index 963dd873..869d9475 100644 --- a/mmgen/swap/asset.py +++ b/mmgen/swap/asset.py @@ -72,9 +72,13 @@ class SwapAsset: def chain(self): return self.data.full_name.split('.', 1)[0] if self.data.full_name else self.name + @property + def coin(self): + return self.data.name or self.data.full_name.split('.', 1)[0] + @property def asset(self): - return self.data.full_name.split('.', 1)[1] if self.data.full_name else None + return None if self.data.name else self.data.full_name.split('.', 1)[1] @property def full_name(self): diff --git a/mmgen/swap/proto/thorchain/memo.py b/mmgen/swap/proto/thorchain/memo.py index f9fa52a6..0d53c26c 100755 --- a/mmgen/swap/proto/thorchain/memo.py +++ b/mmgen/swap/proto/thorchain/memo.py @@ -116,7 +116,7 @@ class THORChainMemo: assert trade_limit is None or isinstance(trade_limit, UniAmt), f'{type(trade_limit)} != {UniAmt}' assert is_coin_addr(proto, addr) - assert asset.chain == proto.coin, f'{asset.chain} != {proto.coin}' + assert asset.coin == proto.coin, f'{asset.coin} != {proto.coin}' assert asset.asset == getattr(proto, 'tokensym', None), ( f'{asset.asset} != {getattr(proto, "tokensym", None)}') assert asset.direction == 'recv', f'{asset.direction} != ‘recv’' diff --git a/mmgen/tx/new_swap.py b/mmgen/tx/new_swap.py index e8faed77..ba948dd3 100755 --- a/mmgen/tx/new_swap.py +++ b/mmgen/tx/new_swap.py @@ -25,7 +25,7 @@ def init_swap_proto(cfg, asset): from ..protocol import init_proto return init_proto( cfg, - asset.chain, + asset.coin, network = cfg._proto.network, tokensym = asset.asset, need_amt = True)