Open lucasoares opened 5 months ago
I think it may be related to the transaction version or transaction encoding... The resulting bytes of the transaction serialization are very different from the ts
code... Needs more debugging...
Edit: doing a little more debugging, if I sign the transaction, the resulting bytes will be parsed correctly and the simulation will run "correctly". I think the current marshal algorithm can't work for transactions without signatures.
The problem is: signing the transaction will not work for me, since I need the signer to be RaydiumSimuLateTransaction11111111111111111
to the raydium simulation to return the result I need...
Any idea about what needs to be done to be able to simulate transactions without signing?
Edit2: I made it work by adding a random signature in the tx.Signatures
, but that should not be necessary, it is a bug..
I am getting the same issue when implementing raydium sdk in go, did you find anything that could help? @lucasoares
@jamalphasquad , We need to add a random secret for signing Tx I can see logs now return from RPC,Pushed the changes
same issue, i fixed it with create new sign transaction,
recent, err := cluster.GetRecentBlockhash(context.Background(), "")
if err != nil {
return "", fmt.Errorf("cannot get recent blockHash -> %v", err)
}
payer, err := solana.PrivateKeyFromBase58("privatekey")
if err != nil {
return "", fmt.Errorf("private key from -> %v", err)
}
tx, err := solana.NewTransaction(
[]solana.Instruction{
system.NewTransferInstruction(
solana.LAMPORTS_PER_SOL/1000, payer.PublicKey(), toAddr).Build(),
},
recent.Value.Blockhash,
solana.TransactionPayer(payer.PublicKey()),
)
if err != nil {
return "", fmt.Errorf("new transaction -> %v", err)
}
_, err = tx.Sign(
func(key solana.PublicKey) *solana.PrivateKey {
if payer.PublicKey().Equals(key) {
return &payer
}
return nil
})
fmt.Println("waiting 10sec")
result, err := cluster.SendTransaction(context.Background(), tx)
maybe this is useful
Have you solved it? I have the same problem and I am looking for a solution. @lucasoares
Have you solved it? I have the same problem and I am looking for a solution. @lucasoares
Yea, I made it work by adding a random signature in the tx.Signatures
haha sad but the only workaround I found.
Maybe it's related to https://github.com/gagliardetto/solana-go/issues/134, but idk if it is the same issue.
I'm trying to port
raydium-sdk
to golang usingsolana-go
and everything is going well, but I can't get theLiquidity.fetchInfo
working on golang.Raydium's SDK implementation for the
fetchInfo
function is: creates an instruction, simulates it, and then parses the logs from the simulation to get liquidity pool information.The function to create the instruction: https://github.com/raydium-io/raydium-sdk/blob/c44123e6df72c589a55eca6a595fd1153a176546/src/liquidity/liquidity.ts#L1318
Then this transaction instruction is included in a transaction and sent to RPC using the
simulateMultipleInstruction
function: https://github.com/raydium-io/raydium-sdk/blob/c44123e6df72c589a55eca6a595fd1153a176546/src/common/web3.ts#L235.I made a dummy code with the raw implementation for both
ts
andgolang
using a RANDOM (no idea who owns it) liquidity pool as an example:ts
implementation:Output:
golang
implementation:Output:
I'm trying to debug why this is happening, but because of my lack of understanding about
solana-go
internals, it is going pretty slowly...Thanks.