python-binance-chain icon indicating copy to clipboard operation
python-binance-chain copied to clipboard

"Wallet environment doesn't match HttpApiClient environment" on main-net

Open wally-yu opened this issue 5 years ago • 3 comments

Dear @sammchardy

I saw "Wallet environment doesn't match HttpApiClient environment" issue again, but this time on main-net.

Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 05:52:31)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from binance_chain.http import HttpApiClient
>>> from binance_chain.messages import TransferMsg
>>> from binance_chain.wallet import Wallet
>>> wallet = Wallet('ef5b7ba4eb6a7add623315e1edc90b3fc24ff107bc874e168d188ab9bd4_____')
>>> client = HttpApiClient()
>>> transfer_msg = TransferMsg(
...     wallet=wallet,
...     symbol='BNB',
...     amount=1,
...     to_address='bnb1r4gc5ftrkr9ez2khph4h5xxd0mf0hd75uux7gl',
...     memo='Thanks for the beer'
... )
>>>
>>> res = client.broadcast_msg(transfer_msg, sync=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/yuwally/Documents/venv/p30/lib/python3.6/site-packages/binance_chain/http.py", line 367, in broadcast_msg
    raise BinanceChainBroadcastException("Wallet environment doesn't match HttpApiClient environment")
binance_chain.exceptions.BinanceChainBroadcastException: Wallet environment doesn't match HttpApiClient environment

this happens for version 0.1.19 as well as 0.1.10.

Could you please help give any suggestion on how to avoid this issue?

Thanks in advance.

wally-yu avatar Jun 13 '19 10:06 wally-yu

I solved this issue putting the environment in wallet and client.

env = BinanceEnvironment.get_production_env() wallet = Wallet('',env=env) client = HttpApiClient(env)

wxy122221 avatar Jun 13 '19 14:06 wxy122221

hi @wxy122221 , thanks for pointing out, i tried in my daytime, not work, but it works just now by adding production env :)

wally-yu avatar Jun 13 '19 14:06 wally-yu

You are welcome! Looking forward to your SDK to place order. @wally-yu

wxy122221 avatar Jun 13 '19 15:06 wxy122221