Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
XueMoMo committed Oct 21, 2024
1 parent 634ec83 commit d707f17
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
7 changes: 3 additions & 4 deletions lib/wallet/MWalletConnect.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import IEthereumProvider, { EthereumProvider } from "@walletconnect/ethereum-provider";
import { WalletConnectModal } from "@walletconnect/modal";
import { BaseWallet, LoginUser } from "./types";
import _ from "lodash";
import { BaseWallet, LoginUser } from "./types";

export class MWalletConnect extends BaseWallet {
name = "Wallet Connect";
icon = "/images/wallet_connect.png";
icon = "/images/group_wallet_connect.png";
ethereumProvider: IEthereumProvider;
accounts: string[] = [];
account: string;
Expand Down Expand Up @@ -88,7 +87,7 @@ export class MWalletConnect extends BaseWallet {
}

async sign(data: string, account: string | undefined): Promise<string> {
const res = await this.ethereumProvider.request({ method: "personal_sign", params: [Buffer.from(data, "utf8").toString("hex"), account] });
const res = await this.ethereumProvider.request({ method: "personal_sign", params: [data, account] });
console.info("res:", res);
// const res = await this.connector?.signPersonalMessage([convertUtf8ToHex(data), account]);
return res as string;
Expand Down
2 changes: 1 addition & 1 deletion lib/wallet/Metamask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class Metamask extends BaseWallet {
const ethereum = mWin.ethereum;
console.info("ethereum::", mWin.ethereum);
this.ethereum = ethereum;
if (this.ethereum) {
if (this.ethereum && typeof this.ethereum.chainId == "string") {
this.chainId = parseInt(ethereum.chainId.replace("0x", ""), 16);
this.setLis();
}
Expand Down
3 changes: 1 addition & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ declare global {
}
}

const recomendWallets: BaseWallet[] = [WALLETMAP.crust, WALLETMAP.metamask, WALLETMAP["ton-connect"]];
const recomendWallets: BaseWallet[] = [WALLETMAP.crust, WALLETMAP.metamask, WALLETMAP['wallet-connect'], WALLETMAP["ton-connect"]];
const moreWallets: BaseWallet[] = [
WALLETMAP.algorand,
WALLETMAP["aptos-martian"],
WALLETMAP["aptos-petra"],
WALLETMAP.elrond,
WALLETMAP.metax,
WALLETMAP.mimir,
WALLETMAP["wallet-connect"],
WALLETMAP["polkadot-js"],
WALLETMAP.solana,
WALLETMAP.subWallet,
Expand Down

0 comments on commit d707f17

Please sign in to comment.