diff --git a/mmgen/proto/btc/tx/new_swap.py b/mmgen/proto/btc/tx/new_swap.py index a59b8c2d..24551ba3 100755 --- a/mmgen/proto/btc/tx/new_swap.py +++ b/mmgen/proto/btc/tx/new_swap.py @@ -22,8 +22,8 @@ class NewSwap(New, TxNewSwap): def update_data_output(self, trade_limit): sp = get_swap_proto_mod(self.swap_proto) o = self.data_output._asdict() - parsed_memo = sp.data.parse(o['data'].decode()) - memo = sp.data( + parsed_memo = sp.Memo.parse(o['data'].decode()) + memo = sp.Memo( self.recv_proto, self.recv_proto.coin_addr(parsed_memo.address), trade_limit = trade_limit) diff --git a/mmgen/proto/eth/tx/new_swap.py b/mmgen/proto/eth/tx/new_swap.py index 912cafc1..e7c3119a 100755 --- a/mmgen/proto/eth/tx/new_swap.py +++ b/mmgen/proto/eth/tx/new_swap.py @@ -22,8 +22,8 @@ class NewSwap(New, TxNewSwap): def update_data_output(self, trade_limit): sp = get_swap_proto_mod(self.swap_proto) data = bytes.fromhex(self.txobj['data']) if self.is_bump else self.usr_contract_data - parsed_memo = sp.data.parse(data.decode()) - memo = sp.data( + parsed_memo = sp.Memo.parse(data.decode()) + memo = sp.Memo( self.recv_proto, self.recv_proto.coin_addr(parsed_memo.address), trade_limit = trade_limit) diff --git a/mmgen/swap/proto/thorchain/__init__.py b/mmgen/swap/proto/thorchain/__init__.py index ddd6aa16..56c5e849 100755 --- a/mmgen/swap/proto/thorchain/__init__.py +++ b/mmgen/swap/proto/thorchain/__init__.py @@ -12,7 +12,7 @@ swap.proto.thorchain: THORChain swap protocol implementation for the MMGen Wallet suite """ -__all__ = ['data'] +__all__ = ['Memo'] name = 'THORChain' @@ -42,4 +42,4 @@ def rpc_client(tx, amt): from .thornode import Thornode return Thornode(tx, amt) -from .memo import Memo as data +from .memo import THORChainMemo as Memo diff --git a/mmgen/swap/proto/thorchain/memo.py b/mmgen/swap/proto/thorchain/memo.py index e34317fe..91532d17 100755 --- a/mmgen/swap/proto/thorchain/memo.py +++ b/mmgen/swap/proto/thorchain/memo.py @@ -17,7 +17,7 @@ from ....amt import UniAmt from . import name as proto_name -class Memo: +class THORChainMemo: # The trade limit, i.e., set 100000000 to get a minimum of 1 full asset, else a refund # Optional. 1e8 or scientific notation diff --git a/mmgen/tx/completed.py b/mmgen/tx/completed.py index b9e472c8..8bc181fb 100755 --- a/mmgen/tx/completed.py +++ b/mmgen/tx/completed.py @@ -71,7 +71,7 @@ class Completed(Base): def check_swap_memo(self): if data := self.get_tx_usr_data(): - from ..swap.proto.thorchain.memo import Memo + from ..swap.proto.thorchain import Memo if Memo.is_partial_memo(data): from ..protocol import init_proto text = data.decode('ascii') diff --git a/mmgen/tx/info.py b/mmgen/tx/info.py index 632cc49d..257d914b 100755 --- a/mmgen/tx/info.py +++ b/mmgen/tx/info.py @@ -73,13 +73,13 @@ class TxInfo: yield f' {tx.coin} TxID: {tx.coin_txid.hl()}\n' if tx.is_swap: - from ..swap.proto.thorchain.memo import Memo, proto_name + from ..swap.proto.thorchain import Memo, name data = ( (tx.usr_contract_data or bytes.fromhex(tx.txobj['data'])) if tx.proto.is_evm else tx.data_output.data) if Memo.is_partial_memo(data): p = Memo.parse(data.decode('ascii')) - yield ' {} {}\n'.format(magenta('DEX Protocol:'), blue(proto_name)) + yield ' {} {}\n'.format(magenta('DEX Protocol:'), blue(name)) yield ' Swap: {}\n'.format(orange(f'{tx.proto.coin} => {p.asset}')) yield ' Dest: {}{}\n'.format( cyan(p.address), diff --git a/mmgen/tx/new_swap.py b/mmgen/tx/new_swap.py index e10e6d18..dd67af84 100755 --- a/mmgen/tx/new_swap.py +++ b/mmgen/tx/new_swap.py @@ -139,7 +139,7 @@ class NewSwap(New): 'To sign this transaction, autosign or txsign must be invoked' ' with --allow-non-wallet-swap')) - memo = sp.data(self.recv_proto, recv_output.addr) + memo = sp.Memo(self.recv_proto, recv_output.addr) # this goes into the transaction file: self.swap_recv_addr_mmid = recv_output.mmid diff --git a/test/modtest_d/swap.py b/test/modtest_d/swap.py index 7391ed46..bc65287c 100755 --- a/test/modtest_d/swap.py +++ b/test/modtest_d/swap.py @@ -13,7 +13,7 @@ class unit_tests: def memo(self, name, ut, desc='Swap transaction memo'): from mmgen.protocol import init_proto from mmgen.amt import UniAmt - from mmgen.swap.proto.thorchain import data as Memo + from mmgen.swap.proto.thorchain import Memo for coin, addrtype in ( ('ltc', 'bech32'), ('bch', 'compressed'),