I'm using the managed pump portal API and whenever I sell, then try to lookup the transaction it returns an error "not found".
out, err := solanaClient.GetTransaction(
context.Background(),
sig,
&solanaRPC.GetTransactionOpts{
MaxSupportedTransactionVersion: &transactionVersion,
Encoding: solana.EncodingBase64,
},
)
The signature I received does show up on solscan as processed or confirmed but I can't access it through the rpc. I'm using Helius free RPC. I tried waiting 3 minutes between selling and looking up the transaction but no luck.
I also tried checking the signature status:
out, err := solanaClient.GetSignatureStatuses(
context.Background(),
false,
solana.MustSignatureFromBase58(resp.Signature),
)
)
if err != nil {panic(err)}
fmt.Println(out.Value[0].ConfirmationStatus)
fmt.Println(out.Value[0].Err)
I can look the signature up just fine and it returns "confirmed" and "nil" for the error, yet I still can't look up the transaction itself.
I've been stuck on this for a week or two and I can't figure out what's causing the issue or how to get around it, any help would be greatly appreciated.
I had similar issue using the dedicated Solana API.
In my case I realized that the API has some delay in retriving the transaction, so I made a function that calls the API multiple time. usually at the 3rd attempt if the transaction actually was finalized the API responds.
def get_transaction(sig, max_retries=5, retry_delay=15):
client = Client("https://api.mainnet-beta.solana.com")
retries = 0
while retries < max_retries:
try:
# Make the API request
response = client.get_transaction(sig, max_supported_transaction_version=0)
#print(response)
# Check if the response is not None
if response.value is not None:
#print(response.value)
return response
else:
print("Received empty response. Retrying...")
except Exception as e:
print(f"Error: {e}.")
raise Exception(f"Failed to fetch transaction after {max_retries} attempts.")
# Wait before retrying
retries += 1
time.sleep(retry_delay)
return response