Closed F-OBrien closed 2 years ago
Ok I confirmed for myself that the genesis hash set to testnet is what prevents the ledger wallets from being used from the Polymesh wallet extension with the Polkadot js dApp. I used the Polkadot extension and toggled between Polymesh and other networks which updates the account genesis hash and visibility in the accounts tab of the polkadot.js dApp.
As the extension already has a network toggle I suggest it also changes the associated genesis hash for accounts similar to how the Polkadot extension now allows selection of networks as per below.
Side note: I noticed that Polymesh Accounts all have a keypair type of undefined. I'm guessing that dApps that encounter a keypair type of undefined they assume sr25519
but this should be explicitly stated rather than assuming somewhere else has a catch for undefined as acceptable keypair type appear to be only 'ed25519' | 'sr25519' | 'ecdsa' | 'ethereum'
. I've not looked into it to see how the stored keypair type could cause issues for specific dApps or other polkadot/substrate tools.
Irrespective of whether the wallet is set to mainnet or testnet the account information returned by web3Enable, web3Accounts etc. returns the testnet genesis hash "0x2ace05e703aa50b48c0ccccfc8b424f7aab9a1e2c424ed12e45d20b1e8ffd0d6". The testnet genesis hash gets hard coded at ledger import https://github.com/PolymathNetwork/polymesh-wallet/blob/f72572b250c984341c6423ab4dcf0ff7184234a1/packages/ui/src/Popup/ImportLedger/ImportLedger.tsx#L53
I believe this is the reason https://mainnet-app.polymesh.network/ does not support ledger keys from the wallet extension but https://testnet-app.polymesh.live/ does.
I suspect either omitting the optional a genesis hash (as is done for all other account types) or dynamically switching hash based on the selected network should resolve the issue.