-
I am trying to getfeeformessage in the Solana chain where I need Base64 of encoding message. I created code like below val transferMessage = Solana.Transfer.newBuilder().apply {
recipient = AnyAddress(receiver, CoinType.SOLANA).description()
value = amount.toBigDecimal().toWEI(decimals).toLong()
}.build()
val signingInput = Solana.SigningInput.newBuilder().apply {
transferTransaction = transferMessage
recentBlockhash = blockhash
privateKey = ByteString.copyFrom(Base58.decodeNoCheck(_privateKey))
}.build()
val output = AnySigner.sign(signingInput, CoinType.SOLANA, Solana.SigningOutput.parser()) output.encode what I get but, when Pass Base64 encode or without encode Solana throw error Kindly help to resolve this |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 12 replies
-
Hi, I think what you need to pass as a parameter is |
Beta Was this translation helpful? Give feedback.
-
Thanks for answer I also thought but that is also not working |
Beta Was this translation helpful? Give feedback.
-
Hello @blukhi99 - can you give more information, what's the bug you are facing now? |
Beta Was this translation helpful? Give feedback.
-
Some comments:
|
Beta Was this translation helpful? Give feedback.
-
Hello @Milerius and @catenocrypt let me explain more. one, more thing I saw Sign Message of Wallet-core lib and Solanj are different for the same parameters.
|
Beta Was this translation helpful? Give feedback.
-
Do you have an example of a |
Beta Was this translation helpful? Give feedback.
-
The data in your example seems incorrect ( |
Beta Was this translation helpful? Give feedback.
-
My random guess is that this method expects only message, without signatures.
|
Beta Was this translation helpful? Give feedback.
-
@blukhi99 did you find the way to receive correct message? |
Beta Was this translation helpful? Give feedback.
-
You need a transaction message without signatures for it. Trustwallet-core lib has this in C but it is not exposed. One way is that they expose it :) The second way is more workaround that. You can remove signatures out of signed transaction message. This will help you understand the format of the transaction https://docs.solana.com/developing/programming-model/transactions#transaction-format Here is example how you can do it in kotlin:
Implementation of u16Decoder can be based (rewritten in kotlin) on this rust implementation https://github.com/solana-labs/solana/blob/b8837c04ec3976c9c16d028fbee86f87823fb97f/sdk/program/src/short_vec.rs#L131 |
Beta Was this translation helpful? Give feedback.
My random guess is that this method expects only message, without signatures.
SignatureOutput.encoded
from wallet core starts out with the signature.