mchardysam / python-binance-chain

Binance Chain Exchange API python implementation for automated trading
http://python-binance-chain.rtfd.io
MIT License
303 stars 132 forks source link

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

Open wally-yu opened 5 years ago

wally-yu commented 5 years ago

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.

wxy122221 commented 5 years ago

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

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

wally-yu commented 5 years ago

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

wxy122221 commented 5 years ago

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