Skip to content

Commit

Permalink
fix address
Browse files Browse the repository at this point in the history
  • Loading branch information
zakir-code committed Oct 12, 2023
1 parent 17d532c commit fe320db
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion fxsdk/client/crosschain.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Optional

import requests
from eth_utils import is_hex_address

from fxsdk.client.grpc import Client, GRPCBlockHeightHeader
from fxsdk.msg import new_ibc_fx_msg_transfer
Expand Down Expand Up @@ -73,7 +74,8 @@ def ibc_transfer(self, tx_builder: TxBuilder, to_address: str, amount: Coin, cha
elif target is CrossChainTarget.MarginX:
pass
elif target is CrossChainTarget.FxCore:
pass
if is_hex_address(to_address) is False:
raise Exception("address should be hex format")
else:
raise Exception("target chain not supported")
sender = tx_builder.from_address().to_string()
Expand Down
3 changes: 3 additions & 0 deletions fxsdk/wallet/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ def to_hex(self) -> str:

def to_bytes(self) -> bytes:
return self._data

def prefix(self) -> str:
return self._prefix
2 changes: 1 addition & 1 deletion tests/test_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_ibc_transfer_mx2eth(self):
print("no channel found")
return
channel = channels[0].channel_id
to_address = tx_builder.from_address().to_string()
to_address = tx_builder.from_address().to_hex()
amount = Coin(denom='FX', amount='100')
tx_response = grpc_cli.ibc_transfer(tx_builder=tx_builder, to_address=to_address, amount=amount,
channel=channel, target=CrossChainTarget.Ethereum,
Expand Down

0 comments on commit fe320db

Please sign in to comment.