new proto.vm.tx.new_swap module
This commit is contained in:
parent
d1596a6e9a
commit
76a913678d
2 changed files with 37 additions and 19 deletions
|
|
@ -13,29 +13,14 @@ proto.eth.tx.new_swap: Ethereum new swap transaction class
|
|||
"""
|
||||
|
||||
from ....tx.new_swap import NewSwap as TxNewSwap
|
||||
|
||||
from ...vm.tx.new_swap import VmNewSwap
|
||||
|
||||
from .new import New, TokenNew
|
||||
|
||||
class NewSwap(New, TxNewSwap):
|
||||
class NewSwap(VmNewSwap, New, TxNewSwap):
|
||||
desc = 'Ethereum swap transaction'
|
||||
|
||||
def update_data_output(self, trade_limit):
|
||||
parsed_memo = self.swap_proto_mod.Memo.parse(self.swap_memo)
|
||||
self.swap_memo = str(self.swap_proto_mod.Memo(
|
||||
self.swap_cfg,
|
||||
self.recv_proto,
|
||||
self.recv_asset,
|
||||
self.recv_proto.coin_addr(parsed_memo.address),
|
||||
trade_limit = trade_limit))
|
||||
self.set_gas_with_data(self.swap_memo.encode())
|
||||
|
||||
@property
|
||||
def vault_idx(self):
|
||||
return 0
|
||||
|
||||
@property
|
||||
def vault_output(self):
|
||||
return self.outputs[0]
|
||||
|
||||
class TokenNewSwap(TokenNew, NewSwap):
|
||||
desc = 'Ethereum token swap transaction'
|
||||
|
||||
|
|
|
|||
33
mmgen/proto/vm/tx/new_swap.py
Executable file
33
mmgen/proto/vm/tx/new_swap.py
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# MMGen Wallet, a terminal-based cryptocurrency wallet
|
||||
# Copyright (C)2013-2025 The MMGen Project <mmgen@tuta.io>
|
||||
# Licensed under the GNU General Public License, Version 3:
|
||||
# https://www.gnu.org/licenses
|
||||
# Public project repositories:
|
||||
# https://github.com/mmgen/mmgen-wallet
|
||||
# https://gitlab.com/mmgen/mmgen-wallet
|
||||
|
||||
"""
|
||||
proto.vm.tx.new_swap: new swap transaction methods for VM chains
|
||||
"""
|
||||
|
||||
class VmNewSwap:
|
||||
|
||||
def update_data_output(self, trade_limit):
|
||||
parsed_memo = self.swap_proto_mod.Memo.parse(self.swap_memo)
|
||||
self.swap_memo = str(self.swap_proto_mod.Memo(
|
||||
self.swap_cfg,
|
||||
self.recv_proto,
|
||||
self.recv_asset,
|
||||
self.recv_proto.coin_addr(parsed_memo.address),
|
||||
trade_limit = trade_limit))
|
||||
self.set_gas_with_data(self.swap_memo.encode())
|
||||
|
||||
@property
|
||||
def vault_idx(self):
|
||||
return 0
|
||||
|
||||
@property
|
||||
def vault_output(self):
|
||||
return self.outputs[0]
|
||||
Loading…
Add table
Add a link
Reference in a new issue