lee
lee

Reputation: 1

Unable to retrieve keypair xxx

Issues with upgrading chrome extension mv2 to mv3
error: Unable to retrieve keypair 'cTM3b5VHhkviXcXsg6QLMpK4W4vgNd6fjCi26CdXd4s7q4jud'

github issue

I upgraded the @polkadot/ui-keyring version. The problem still occurred according to the official example. There was no problem in v2.

error: Unable to retrieve keypair 'cTM3b5VHhkviXcXsg6QLMpK4W4vgNd6fjCi26CdXd4s7q4jud'

node version --> 14.7

Polkadot package versions:

"@polkadot/api": "4.13.1",
"@polkadot/api-contract": "4.13.1",
"@polkadot/extension-inject": "0.38.1",
"@polkadot/react-identicon": "0.80.1",
"@polkadot/ui-keyring": "0.80.1",
"@polkadot/wasm-crypto": "^6.2.1",
keyringInit:
   
keyring.loadAll({
        ss58Format: 42,
        type: "sr25519",
      });


const getSignMessage = async (account, password, message) => {
try {
const accountPair =keyring.getPair(account.address);

if (accountPair.isLocked) {
  accountPair.unlock(password);
}
const signedMessage = u8aToHex(
  accountPair.sign(stringToU8a(message.message))
);
const result = {
  account: getAccountForUI(account),
  message: {
    ...message,
    signedMessage,
  },
};
return result;
} catch (err) {
console.error("getSignMessage error", err);
}
};

Upvotes: 0

Views: 28

Answers (0)

Related Questions