【问题标题】:Algorand WalletConnect connection not showing metadata on Pera WalletAlgorand WalletConnect 连接未在 Pera 钱包上显示元数据
【发布时间】: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>
);

据我了解,它应该显示我发送到connectorclientMeta 数据,但它只显示空字符串并且在 Pera 钱包应用程序上没有图像。

【问题讨论】:

    标签: decentralized-applications wallet-connect algorand


    【解决方案1】:

    不幸的是,Pera Wallet 的 WalletConnect 文档似乎并未表明支持 clientMeta。 见https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0025.mdhttps://developer.algorand.org/docs/get-details/walletconnect/

    但是,它仍应显示正确的 URL。 您可以将看到的内容与 https://algorand.github.io/walletconnect-example-dapp/ 进行比较(显示 URL https://algorand.github.io

    小提示:一般来说,您可以通过在 https://forum.algorand.org 上发布与 Algorand 相关的问题来获得更快的答案

    【讨论】:

      猜你喜欢
      • 2022-10-22
      • 1970-01-01
      • 2022-11-04
      • 2022-07-06
      • 1970-01-01
      • 1970-01-01
      • 2020-07-27
      • 2021-11-28
      • 1970-01-01
      相关资源
      最近更新 更多