Algorand WalletConnect连接未在Pera钱包上显示元数据

发布于 2025-02-03 04:35:37 字数 1308 浏览 2 评论 0 原文

我正在尝试使用WalletConnect在NextJS应用程序和我的Algorand Wallet(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>
);

,它应该从我了解的内容中显示 clientmeta 数据我发送到 connector ,但它只是显示空字符串,而在Pera Wallet应用程序上没有图像。

I'm trying to get a working connection between a NextJS application and my Algorand wallet (Pera) using WalletConnect. I am able to connect, but the NextJS application won't send any metadata like dApp name. Is there something wrong with my code?

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 ...
    }

And I call the connectWallet function from a simple onClick

return (
    <div>
        {/* Add button to call connectWallet */}
        <button onClick={() => connectWallet()}>Connect Wallet</button>
    </div>
);

From what I understand, it should show the clientMeta data I send to the connector, but it just shows empty strings and no image on the Pera wallet app.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

层林尽染 2025-02-10 04:35:37

不幸的是,Pera Wallet的WalletConnect文档似乎并未表明 Clientmeta 的支持。
参见 https:// developer.algorand.org/docs/get-details/walletconnect/

但是,它仍应显示正确的URL。
您可以将您看到的内容与(显示url https://algorand.github.io

小注意:通常,您可能会通过在

The WalletConnect documentation for Pera Wallet does not seem to indicate support of clientMeta unfortunately.
See https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0025.md and https://developer.algorand.org/docs/get-details/walletconnect/

However, it should still display the right URL.
You can compare what you see with https://algorand.github.io/walletconnect-example-dapp/ (that displays the URL https://algorand.github.io)

Small note: in general, you may get faster answers by posting Algorand-related questions on https://forum.algorand.org

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文