help, tool, tx.base_swap: remove swap-proto-dependent code
This commit is contained in:
parent
c29fd6a828
commit
f7e6904d6d
4 changed files with 10 additions and 10 deletions
|
|
@ -26,9 +26,10 @@ def help(proto, cfg):
|
|||
For individual command usage, invoke ‘{gc.prog_name} --coin={cfg.coin.lower()} help COMMAND’
|
||||
"""
|
||||
|
||||
match cfg.coin:
|
||||
case 'RUNE':
|
||||
from ..proto.rune.rpc.remote import THORChainRemoteRPCClient as rpc
|
||||
match proto.base_proto:
|
||||
case 'THORChain':
|
||||
from ..rpc import get_remote_rpc
|
||||
rpc = get_remote_rpc(cfg, proto)
|
||||
clist = '\n ' + '\n'.join(gen_main_help(
|
||||
mods_data = rpc.mods,
|
||||
get_mod_cls_func = lambda x: rpc,
|
||||
|
|
|
|||
|
|
@ -40,13 +40,13 @@ an OP_RETURN data output with a zero spend amount. This is the preferred way
|
|||
to embed data in the blockchain. {ds}
|
||||
""".format(ds=data_spec_info.format(dl=proto.max_op_return_data_len))
|
||||
case 'THORChain':
|
||||
from ..swap.proto.thorchain.memo import THORChainMemo
|
||||
from ..swap.util import get_swap_proto_mod
|
||||
outputs_info = """
|
||||
The transaction output is specified in the form ADDRESS,AMOUNT.
|
||||
|
||||
A single DATA_SPEC argument may also be given on the command line to embed
|
||||
data (e.g. a memo) in the transaction. {ds}
|
||||
""".format(ds=data_spec_info.format(dl=THORChainMemo.max_len))
|
||||
""".format(ds=data_spec_info.format(dl=get_swap_proto_mod(cfg.swap_proto).Memo.max_len))
|
||||
case _:
|
||||
outputs_info = """
|
||||
The transaction output is specified in the form ADDRESS,AMOUNT.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class tool_cmd(tool_cmd_base):
|
|||
|
||||
assert self.cfg.coin == 'BTC', '--coin arg not supported for this command'
|
||||
|
||||
from ..swap.proto.thorchain.memoless import THORChainMemolessAmount
|
||||
from ..swap.util import get_coin_amt
|
||||
from ..swap.util import get_swap_proto_mod, get_coin_amt
|
||||
|
||||
return str(THORChainMemolessAmount(get_coin_amt(self.cfg, asset, amt), refnum).amt)
|
||||
return str(get_swap_proto_mod(self.cfg.swap_proto).memoless_amt(
|
||||
get_coin_amt(self.cfg, asset, amt), refnum).amt)
|
||||
|
|
|
|||
|
|
@ -59,8 +59,7 @@ class BaseSwapMethods:
|
|||
if hasattr(self, 'swap_recv_asset_spec'):
|
||||
return self.swap_proto_mod.SwapAsset(self.swap_recv_asset_spec, 'recv')
|
||||
elif self.is_swap and hasattr(self, 'data_output'):
|
||||
from ..swap.proto.thorchain.memo import THORChainMemo
|
||||
return THORChainMemo.parse(str(self.data_output.data)).asset
|
||||
return self.swap_proto_mod.Memo.parse(str(self.data_output.data)).asset
|
||||
else: # backwards-compatibility workaround
|
||||
from ..swap.asset import SwapAsset
|
||||
x = '[unknown]'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue