Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signTransaction() not worked, error as "WalletSignTransactionError: Expected String" #29

Open
jackalchenxu opened this issue Aug 16, 2022 · 4 comments

Comments

@jackalchenxu
Copy link

Hello, lorisleiva, thanks for your great work.

i'm now trying use solana-wallets-vue with Vue3 and make a simple test, like the sample code;
wallet software is Phantom, installed as Chrome plugin;
wallet is changed to use your lib.

the sample code is like below:

import { useWallet }  from `solana-wallets-vue`;
import { Connection, Transaction } from `@solana/web3.js`;
...
const { wallet, publicKey }  = useWallet();
...
let transaction = new Transaction().add(
  SystemProgram.transfer({
    fromPubkey: wallet.publicKey,
    toPubkey: wallet.publicKey,
    lamports: 100,
  })
);
let { blockhash } = await connection.getRecentBlockhash();
transaction.recentBlockhash = blockhash;
transaction.feePayer = wallet.publicKey;
let signed = await wallet.signTransaction(transaction);
let txid = await connection.sendRawTransaction(signed.serialize());
await connection.confirmTransaction(txid);

the error occurs at let signed = await wallet.signTransaction(transaction);, the error message as: WalletSignTransactionError: Expected String at PhantomWalletAdatapter,signTransaction

i trace the code, and under the hood, the code shows wallet need its secretkey to sign a transaction, but all know, the wallet doesn't expose the secretkey.

if we change the above sample code, not sign the transaction, but directly sendTransaction(...), it will work!
(sendTransaction will still partialsignTransaction, but in itself inner implementation of wallet code)

Here is my question:

  • am i missing something that makes signTransaction not work?

if you need the full code to reproduce the issue , please comment.

@Psionyc
Copy link

Psionyc commented Aug 28, 2022

Recently there have been lots of errors on the phantom side of solana. While using wallet.sendTransaction() it shows "Missing or Invalid Parameters" with a long stack trace leading back to solana-wallets-vue... I feel this is related so I decided to drop it here....

And I tried the adapters on react and it worked so...

@Aanhane
Copy link
Contributor

Aanhane commented Aug 29, 2022

Yep facing the same issue here. I've tried updating the dependencies but without a guide on how to contribute to the project, it's hard. I'm unable to test the package properly, as I also can't get a fork to simply compile.

@Psionyc
Copy link

Psionyc commented Aug 31, 2022

So after trying somethings I found out wallet.signTransaction.value works and the transaction is signed for all wallets... While checking why the error might have occured with wallet.sendTransaction I found out that in the phantom wallet adapter code the function is named signAndSendTransaction() which might be the overall cause of the error...

@hsienfu
Copy link

hsienfu commented Sep 4, 2022

Maybe the SendOptions is required for wallet.sendTransaction method. Initialize connection with commitmentOrConfig works. const connection = new Connection(clusterApiUrl('devnet'), 'confirmed').

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants