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

[Bug] solana.core.Message.from(byteArray) deserialization bug #120

Open
Funkatronics opened this issue Jan 26, 2023 · 1 comment
Open

[Bug] solana.core.Message.from(byteArray) deserialization bug #120

Funkatronics opened this issue Jan 26, 2023 · 1 comment
Assignees

Comments

@Funkatronics
Copy link
Collaborator

Describe the bug
Trying to build a Transaction object from an array of bytes throws an exception. The exception is thrown by the call to solana.core.Message.from(byteArray) inside of the Transaction.from() method.

To Reproduce

  • create an NFT mint transaction (in my case I am using CreateNftTransactionBuilder().build() from the metaplex-android lib)
  • partial sign the transaction with the payer/owner account
  • serialize the transaction using Transaction.serialize()
  • try to rebuild the transaction object from the serialized bytes using Transaction.from(serializedBytes)

Expected behavior
Transaction.from(serializedBytes) should work the same as manually building the transaction like so (this is our current workaround):

Transaction().apply {
       setRecentBlockHash(recentBlockhash)
       feePayer = creator
       addInstruction(instructions)
       addSignature(creator, primarySignatureFromMwa)
}

SDK Version & Context
Platform: Android
Version: solana-kt:2.0.0

Additional context
We are using metaplex and solanaKT with Mobile Wallet Adapter. Mobile wallet adapter uses raw byte arrays to pass around and sign transactions. This is why we need to serialize the Transaction object into bytes (for MWA signing), then rebuild the Transaction object from the signed bytes (so it can then be passed to sendTransaction or other solanakt/metaplex methods). When fixing this, I am may add some other methods/abstractions to better support raw byte array transactions.

@ajamaica
Copy link
Contributor

I will take a look at this

@ajamaica ajamaica self-assigned this Jan 30, 2023
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