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

TrustWallet - Cannot read properties of undefined (reading "serialize") #987

Open
sineus opened this issue Jun 25, 2024 · 1 comment
Open

Comments

@sineus
Copy link

sineus commented Jun 25, 2024

Describe the bug
Hi everybody, we use Trust wallet adapter on our application and we have a problem when we send transaction, Trust wallet try to serialize message from Transaction entity, but with "legacy" Transaction, there is no message property, only in VersionedTransaction. For me, this adapter isn't fully functional with Solana, have you a solution to fix this?

To Reproduce
Steps to reproduce the behavior:
Create function to create Transaction and send it with the wallet adapter:

// This function does not works
async function createLegacyTransaction(from: PublicKey, to: PublicKey, amount: number) {
  const transaction = new Transaction()

  transaction.add(
    SystemProgram.transfer({
      fromPubkey: from,
      toPubkey: to,
      lamports: amount
    })
  )
  transaction.add(ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 100000 }))

  const { blockhash } = await connection.getLatestBlockhash()

  transaction.recentBlockhash = blockhash
  transaction.feePayer = from

  return transaction;
}

// Function works
async function createVersionedTransaction(from: PublicKey, to: PublicKey, amount: number) {
  const { blockhash } = await connection.getLatestBlockhash()

  const messageV0 = new TransactionMessage({
    payerKey: from,
    recentBlockhash: blockhash,
    instructions: [
      SystemProgram.transfer({
        fromPubkey: from,
        toPubkey: to,
        lamports: amount
      }),
     ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 100000 })
    ],
  }).compileToV0Message();

  return new VersionedTransaction(messageV0)
}

Expected behavior
This wallet should be compatible with Solana "legacy" Transaction.

@glitch-txs
Copy link
Contributor

I think Trust supports the Wallet Standard, why using the adapter?

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