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

SolanaWallet does not support signing transactions from new @solana/web3.js SDK #1678

Open
lithdew opened this issue Jan 3, 2024 · 1 comment

Comments

@lithdew
Copy link

lithdew commented Jan 3, 2024

SolanaWallet does not support signing transactions from the new @solana/web3.js SDK.

As a recommendation to support any Solana transaction in general, it would be great if the SolanaWallet.signTransaction method and its related methods take in a transaction (or multiple transactions) as a Uint8Array rather than a web3.js' Transaction | VersionedTransaction type.

This would also be another step forward in avoiding having @solana/web3.js as a dependency on any of the web3auth packages.

The new SDK and its documentation can be found here: https://github.com/solana-labs/solana-web3.js/tree/master/packages/library

Here is a snippet of how I would expect the whole transaction creation + signing flow with the new web3js SDK look like:

    const tx = pipe(
        createTransaction({ version: 0 }),
        (tx) => setTransactionFeePayer(ctx.session!.publicKey as Address, tx),
        (tx) => setTransactionLifetimeUsingBlockhash(input.lifetime, tx),
        (tx) =>
            appendTransactionInstruction(
                fromLegacySolanaInstruction(
                    ComputeBudgetProgram.setComputeUnitLimit({ units: 500_000 }),
                ),
                tx,
            ),
    );

    const decoded = atob(tx.value);
    const bytes = new Uint8Array(decoded.length);
    for (let i = 0; i < decoded.length; i++) {
        bytes[i] = decoded.charCodeAt(i);
    }

    // Web3auth
    const signed = await wallet.signTransaction(bytes);
@lithdew lithdew changed the title Solana wallet adapter does not support signing transactions from new @solana/web3.js SDK SolanaWallet does not support signing transactions from new @solana/web3.js SDK Jan 3, 2024
@augchan42
Copy link

Is this still an issue or are you using an older version of the Solana client?

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

2 participants