bnb-chain / javascript-sdk

Javascript SDK to communicate with BNB Beacon Chain.
Apache License 2.0
382 stars 236 forks source link

Enabling jdk for mainnet #118

Closed sschiessl-bcp closed 5 years ago

sschiessl-bcp commented 5 years ago

I am connected to mainnet through dex.binance.org and I am converting private key to address, in that process I am getting a ''tbnb'' prefixed address.

How can I switch that behavior?

sschiessl-bcp commented 5 years ago

Found following working:

Default behavior of getAddressFromPublicKey is switching to tbnb. Needs second argument to switch to bnb

notatestuser commented 5 years ago

Solved?

sschiessl-bcp commented 5 years ago

Yes, so far haven't found other need to differentiate between main and testnet

rohitsahu21 commented 5 years ago

having same problem

const BnbApiClient = require('@binance-chain/javascript-sdk');

const api = ' https://dex.binance.org/';

const bncClient = new BnbApiClient(api); bncClient.initChain();

const acc = bncClient.createAccountWithMneomnic(); console.log(acc);

but it create testnet wallet

sschiessl-bcp commented 5 years ago

Check if createAccountWithMneomnic also has second prefix argument

sschiessl-bcp commented 5 years ago

Luke: Use bncClient.chooseNetwork(“mainnet”)

rohitsahu21 commented 5 years ago

Got it Thanks