【发布时间】:2022-06-09 05:07:54
【问题描述】:
我正在尝试使用 WalletConnect 在 NextJS 应用程序和我的 Algorand 钱包 (Pera) 之间建立有效连接。我可以连接,但 NextJS 应用程序不会发送任何元数据,例如 dApp 名称。我的代码有问题吗?
import WalletConnect from "@walletconnect/client";
import QRCodeModal from "algorand-walletconnect-qrcode-modal";
export default function Index(props) {
// Create a connector
const connector = new WalletConnect({
bridge: "https://bridge.walletconnect.org", // Required
qrcodeModal: QRCodeModal,
clientMeta: {
description: "WalletConnect NodeJS Client",
url: "https://nodejs.org/en/",
icons: ["https://nodejs.org/static/images/logo.svg"],
name: "WalletConnect"
}
});
// Create a function to connect
let connectWallet = () => {
if (!connector.connected) {
connector.createSession()
}
// ... Event subscriptions down here ...
}
我从一个简单的onClick 调用connectWallet 函数
return (
<div>
{/* Add button to call connectWallet */}
<button onClick={() => connectWallet()}>Connect Wallet</button>
</div>
);
据我了解,它应该显示我发送到connector 的clientMeta 数据,但它只显示空字符串并且在 Pera 钱包应用程序上没有图像。
【问题讨论】:
标签: decentralized-applications wallet-connect algorand