开发者问题收集

幻影:WalletSignTransactionError:出了点问题

2022-10-22
537

创建一条消息,并且用户对其进行签名。

const anchorWallet = useAnchorWallet();

const createLoginSignature = async () => {
    if (!anchorWallet) return;

    const message = "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAECyIchCFWi8XOQK9v26xdqOA6+Nh0PxppQs5xbNaKQd78FSlNamSkhBk0k6HFg2jh8fDW13bySu4HkH6hAQQVEjevqUjJAYV5RMlecXJFT5t4nmfGtoU+AHeNooBntb74QAQEAxAJzb2xhbmEtd2ViMi1hdXRoLnZlcmNlbC5hcHAgd2FudHMgeW91IHRvIHNpZ24gaW4gd2l0aCB5b3VyIFNvbGFuYSBhY2NvdW50OgpFVm4zb2ZYaXZWTFJ3VXl5U2ZhVE02UmVuanZOTkhUeTM5VFpqMW91QWFITAoKU2lnbiBpbiB3aXRoIFNvbGFuYSB0byB0aGUgYXBwLgoKVVJJOiBodHRwczovL3NvbGFuYS13ZWIyLWF1dGgudmVyY2VsLmFwcApWZXJzaW9uOiAxCkNoYWluIElEOiAxCk5vbmNlOiBkNmJhYTAzMTMxZDEzOWIzZWRiMQpJc3N1ZWQgQXQ6IDIwMjItMTAtMjJUMTg6NDU6NDguOTczWgpFeHBpcmF0aW9uIFRpbWU6IDIwMjItMTAtMjJUMTk6NDU6NDguOTczWgo=";

    const tx = Transaction.from(Buffer.from(message, "base64"));

    const signTx = await anchorWallet.signTransaction(tx);

    const signedData = signTx.serialize().toString("base64");

    return signedData;
};

此代码在 localhost 中有效。

但是我在生产中也遇到了一些错误。

错误描述: Phantom - RPC 错误:出现了问题。 {code: -32603,消息:'出现错误。' }

Localhost(成功) Localhost Phantom Popup Production(失败) Product Phantom Popup

为什么我会遇到这样的错误?

1个回答

解决方案

文件: next.config.js
删除: swcMinify:true

对我有用

Yaryna Gushuley
2022-11-02