Skip to content

More Q&A

Q. How to know whether the address is opened by the dapp browser of Math Wallet ?

There are 2 ways:

1 Lookup Http Header:

If there’s “MathWallet” in User-Agent in HTTP Header, then it is visited by the browser of Math Wallet. (User-Agent: MathWallet)

2 Lookup injected js:

For ETH(BSC/Heco/Polygon and other EVM based), check ethereum.isMathWallet = true

eth

For Polkadot(Kusama/Statemine and other substrate based), check injectedWeb3.mathwallet

dot

For Solana, check solana.isMathWallet = true

solana

Q. How to get more current wallet information, such as orientation / language / fullscreen, etc?

We will need math-js-sdk: https://github.com/mathwallet/math-js-sdk

Q. How to debug a dApp within Math Wallet?

Please read: http://blog.mathwallet.org/?p=154

Q. Does Math Wallet support testnet chain environment and account?

Yes. You will need MathWallet5 or Math Extension Wallet and add testnet as customized network.

Q. How to open a dApp in landscape screen orientation?

There are 2 ways:

1 Math Wallet team can help you config your dApp opened in landscape mode by default, you just need to inform us.

2 You can use math-js-sdk: https://github.com/mathwallet/math-js-sdk, issue the orientation() function.

Q. How to get the current language in the dApp?

Sample code below:

/**
 * @return {string} country code: cn / ko / en
 */
var getNavLanguage = function(){
  navLanguage = (navigator.language || navigator.browserLanguage ).toLowerCase();
  switch(navLanguage)
  {
  case 'zh-cn' || 'zh-tw' || 'zh-hk':
    navLanguage = 'cn';
    break;
  case 'ko':
    navLanguage = 'ko'
    break;
  default:
    navLanguage = 'en';
  }
  return navLanguage;
}

Yes. Sample:

https://blog.mathwallet.org/?p=3389