bitkeep-tron.js 720 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * bitkeep钱包的tron
  3. * @type {{}}
  4. */
  5. let bitkeepTron = {}
  6. /**
  7. * 钱包初始校验
  8. * @returns {*}
  9. */
  10. bitkeepTron.isInstall=function (){
  11. return window.tronLink && window.tronWeb;
  12. }
  13. /**
  14. * 获取基本账户地址
  15. * @returns {Promise<unknown>}
  16. */
  17. bitkeepTron.getAccounts=async function (){
  18. return new Promise(async (resolve, reject) => {
  19. try {
  20. await window.tronLink.request({method: "tron_requestAccounts"});
  21. let selectedAddress = tronWeb.defaultAddress.base58;
  22. resolve(selectedAddress)
  23. }catch (e) {
  24. reject(e)
  25. }
  26. // const balance = await tronWeb.trx.getBalance(this.selectedAddress);
  27. })
  28. }
  29. export default bitkeepTron