Skip to content

Commit ee70c49

Browse files
committed
feat: add MsgSendToEth in the composer
1 parent 79b39aa commit ee70c49

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

pyinjective/composer.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
from .proto.injective.auction.v1beta1 import tx_pb2 as injective_auction_tx_pb
1616

17+
from .proto.injective.peggy.v1 import msgs_pb2 as injective_peggy_tx_pb
18+
1719
from .constant import Denom
1820
from .utils import *
1921

@@ -432,6 +434,27 @@ def MsgRevoke(
432434
msg_type_url=msg_type
433435
)
434436

437+
def MsgSendToEth(
438+
self,
439+
denom: str,
440+
sender: str,
441+
eth_dest: str,
442+
amount: float,
443+
bridge_fee: float
444+
):
445+
446+
peggy_denom, decimals = Denom.load_peggy_denom(self.network, denom)
447+
be_amount = amount_to_backend(amount, decimals)
448+
be_bridge_fee = amount_to_backend(bridge_fee, decimals)
449+
print("Loaded withdrawal symbol {} ({}) with decimals = {}".format(denom, peggy_denom, decimals))
450+
451+
return injective_peggy_tx_pb.MsgSendToEth(
452+
sender=sender,
453+
eth_dest=eth_dest,
454+
amount=self.Coin(amount=be_amount, denom=peggy_denom),
455+
bridge_fee=self.Coin(amount=be_bridge_fee, denom=peggy_denom)
456+
)
457+
435458
# data field format: [request-msg-header][raw-byte-msg-response]
436459
# you need to figure out this magic prefix number to trim request-msg-header off the data
437460
# this method handles only exchange responses

0 commit comments

Comments
 (0)