Skip to content

Commit

Permalink
fix: polkadot extension detection (#1068)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyifeng authored Nov 18, 2024
1 parent fe0c391 commit bd94574
Show file tree
Hide file tree
Showing 3 changed files with 306 additions and 299 deletions.
6 changes: 3 additions & 3 deletions next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"@osn/polkadot-react-identicon": "^1.0.10",
"@osn/previewer": "^1.4.4",
"@osn/rich-text-editor": "^0.6.6",
"@polkadot/extension-dapp": "^0.52.3",
"@polkadot/util": "^13.0.2",
"@polkadot/util-crypto": "^13.0.2",
"@polkadot/extension-dapp": "^0.56.2",
"@polkadot/util": "^13.2.3",
"@polkadot/util-crypto": "^13.2.3",
"@reduxjs/toolkit": "^1.6.1",
"@svgr/webpack": "^6.3.1",
"bignumber.js": "^9.0.1",
Expand Down
10 changes: 5 additions & 5 deletions next/services/chainApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ async function singByMetaMask(text, address) {
}

export const signMessage = async (text, address) => {
if (!address) {
throw new Error("Sign address is missing");
}

if (ethers.utils.isAddress(address)) {
return singByMetaMask(text, address);
}

await web3Enable("opensquare.io");
if (!isWeb3Injected) {
throw new Error("Polkadot Extension is not installed");
}

if (!address) {
throw new Error("Sign addres is missing");
}

await web3Enable("opensquare.io");
const injector = await web3FromAddress(address);

const data = stringToHex(text);
Expand Down
Loading

0 comments on commit bd94574

Please sign in to comment.