XDeFi-tech / examples-dapps-sdk

repository contains examples on how to interact with the xDeFi dApps SDK multichain
https://main.d2ladgp2r2c4c2.amplifyapp.com/
2 stars 6 forks source link

Question: how to get terra address using window.xfi.terra.address ? #15

Closed ap-justin closed 2 years ago

ap-justin commented 2 years ago

Hi, I am trying to use xdefi for terra without @terra-money/wallet-provider and tries to get address via window.xfi.terra.address but it's undefined.

steps taken

  1. prioritized xdefi
  2. enable terra on settins/chain-management
  3. connected using eth_requestAccounts (though doubtful this will also give terra address on window.xfi.terra.address)
hinterlist commented 2 years ago

@ap-justin you should not use window.xfi.terra, it's exposed only for debugging. I'd recommend to use library like terra.js if you don't want to use wallet-provider. Otherwise you can try to get access to the wallet over window.terraWallets object, where all available wallets register them self. Try to open console and send request like:

// Expect that only xdefi is available
const connector = window.terraWallets[0].connector();
connector.requestApproval()
ap-justin commented 2 years ago

@ap-justin you should not use window.xfi.terra, it's exposed only for debugging. I'd recommend to use library like terra.js if you don't want to use wallet-provider. Otherwise you can try to get access to the wallet over

Thanks ser - I have used @terra-money/wallet-provider for terra usage and EIP1193 window.xfi.ethereum for evm-compatible usage