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” Issue #8

Closed wally-yu closed 5 years ago

wally-yu commented 5 years ago

Hi @sammchardy , congratulations and your well structured codes looks really awesome!

I have a small question while running your codes, here are my codes:

from binance_chain.http import HttpApiClient
from binance_chain.messages import TransferMsg
from binance_chain.wallet import Wallet
from binance_chain.environment import BinanceEnvironment

wallet = Wallet('<my private key>')
testnet_env = BinanceEnvironment.get_testnet_env()
client = HttpApiClient(env=testnet_env)

transfer_msg = TransferMsg(
    wallet=wallet,
    symbol='<my symbol>',
    amount=0.08,
    to_address='<my address>'
)
res = client.broadcast_msg(transfer_msg, sync=True)
print(res)

And i got a "Wallet environment doesn't match HttpApiClient environment" error. Not sure if you would have time to fix that prob to enable running on test-net? Thanks in advance.

sammchardy commented 5 years ago

Hi @wally-yu, thanks and congrats on your win too.

You just need to pass the same environment when you initialise the wallet object. If you're using the production system you don't need to worry about setting any environment.

wally-yu commented 5 years ago

works perfectly! thanks for your quick reply :)