bnb-chain / go-sdk

Apache License 2.0
205 stars 97 forks source link

KeyManager - testnet tbnb addresses #51

Closed camstuart closed 5 years ago

camstuart commented 5 years ago

Hi, I would like to understand test / prod wallet addresses better

I am creating a wallet like so:

km, err := keys.NewKeyManager()

And the public address can be obtained with:

address := km.GetAddr() // "bnb1683m5xkxa3p69yagrpdsvkp94xvx6utj863596"

But the testnet address is actually: tbnb1683m5xkxa3p69yagrpdsvkp94xvx6utjf0cs9t

In the Go sdk, how do I derive or obtain the testnet address?

chainwhisper commented 5 years ago

hello, @camstuart You need to specify the network type to testnet:

//-----   Init sdk  -------------
client, err := sdk.NewDexClient("testnet-dex.binance.org", types.TestNetwork, keyManager)
unclezoro commented 5 years ago

or you can set global var types.Network = types.TestNetwork

elvis-hp commented 5 years ago

Thank you so much! I need it toooooo!