SwapAsset: remove asset property

This commit is contained in:
The MMGen Project 2025-06-15 09:17:02 +00:00
commit c83c37d8dd
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
5 changed files with 6 additions and 10 deletions

View file

@ -76,10 +76,6 @@ class SwapAsset:
def coin(self):
return self.data.name or self.data.full_name.split('.', 1)[0]
@property
def asset(self):
return None if self.data.name else self.data.full_name.split('.', 1)[1]
@property
def full_name(self):
return self.data.full_name or f'{self.data.name}.{self.data.name}'

View file

@ -117,8 +117,8 @@ class THORChainMemo:
assert is_coin_addr(proto, addr)
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.tokensym == getattr(proto, 'tokensym', None), (
f'{asset.tokensym} != {getattr(proto, "tokensym", None)}')
assert asset.direction == 'recv', f'{asset.direction} != ‘recv’'
self.addr = addr.views[addr.view_pref]

View file

@ -55,7 +55,7 @@ class Thornode:
die(2, pp_fmt(data))
return data
if self.tx.proto.tokensym or self.tx.recv_asset.asset: # token swap
if self.tx.proto.tokensym or self.tx.recv_asset.tokensym: # token swap
in_data = get_data(
self.tx.send_asset.full_name,
'THOR.RUNE',

View file

@ -27,7 +27,7 @@ def init_swap_proto(cfg, asset):
cfg,
asset.coin,
network = cfg._proto.network,
tokensym = asset.asset,
tokensym = asset.tokensym,
need_amt = True)
def get_send_proto(cfg):

View file

@ -63,7 +63,7 @@ class unit_tests:
return True
def asset(self, name, ut, desc='SwapAsset class'):
for name, full_name, memo_name, chain, asset, direction in (
for name, full_name, memo_name, chain, tokensym, direction in (
('BTC', 'BTC.BTC', 'b', 'BTC', None, 'recv'),
('LTC', 'LTC.LTC', 'l', 'LTC', None, 'recv'),
('BCH', 'BCH.BCH', 'c', 'BCH', None, 'recv'),
@ -74,7 +74,7 @@ class unit_tests:
assert a.name == name
assert a.full_name == full_name
assert a.direction == direction
assert a.asset == asset
assert a.tokensym == tokensym
assert a.chain == chain
assert a.memo_asset_name == memo_name
return True