I am following this guide https://docs.phantom.app/phantom-deeplinks/provider-methods/signandsendtransaction.
I have a complete implementation for the creation of Connect and SignAndSendTransaction deep links but I am getting an unhelpful error message from SignAndSendTransaction deep link: errorCode=-32603 and errorMessage=Unexpected+error.
I see from this page https://docs.phantom.app/solana/errors that error -32603 is an Internal Server Error and Something went wrong within Phantom..
That gives me almost nothing to go off. I have no idea if it is something I am doing wrong.
Connect deep link
users connect their EOA (Externally Owned Account) phantom wallet in telegram
I am able to fully connect a users EOA to my telegram channel using the Connect deeplink by following this guide https://docs.phantom.app/phantom-deeplinks/provider-methods/connect.
I have a phantom-callback endpoint which accepts the response data from a successful connection using a deep link; look below and you can see the logs and code snippets
As you can see, I receive the data from a successful connect deep link, decode it, store it, and later on this data to create a SignAndSendTransaction deeplink
SignAndSendTransaction deeplink
Code snippet of my logic
async def create_sign_and_send_deeplink(public_key: str):
try:
secret_id = "1234567899"
logger.info(f"Creating sign and send deeplink for public key: {public_key}")
# Fetch wallet data (session, nonce, phantom_encryption_public_key, and shared_secret)
wallet_data = await get_wallet_data(public_key)
logger.info(f"Fetched wallet data: {wallet_data}")
if not wallet_data:
logger.error("Failed to retrieve wallet data")
raise Exception("Failed to retrieve wallet data")
else:
session = wallet_data.get('session')
phantom_encryption_public_key = wallet_data.get('phantom_encryption_public_key')
shared_secret_base64 = wallet_data.get('shared_secret')
shared_secret = base64.b64decode(shared_secret_base64) if shared_secret_base64 else None
logger.info(f"Extracted session: {session[:10]}...")
logger.info(f"Extracted phantom_encryption_public_key: {phantom_encryption_public_key}")
logger.info(f"Extracted shared_secret: {shared_secret_base64[:10]}..." if shared_secret_base64 else "No shared_secret")
# Get serialized transaction
logger.info(f"Fetching serialized transaction with secret_id: {secret_id} and public_key: {public_key}")
serialized_tx = await get_serialized_transaction(secret_id, public_key)
logger.info(f"Received serialized transaction: {serialized_tx[:50]}..." if serialized_tx else "No serialized transaction received")
if not serialized_tx:
raise Exception("Failed to get serialized transaction")
# Prepare payload
payload = {
"transaction": serialized_tx,
"session": session
}
logger.info(f"Prepared payload with transaction (first 50 chars): {serialized_tx[:50]}... and session")
# Encrypt the payload using the shared secret
logger.info("Encrypting payload")
nonce = nacl_random(SecretBox.NONCE_SIZE)
secret_box = SecretBox(shared_secret)
encrypted_payload = secret_box.encrypt(json.dumps(payload).encode(), nonce)
logger.info(f"Encrypted payload. Nonce: {base58.b58encode(nonce).decode()}, Encrypted payload length: {len(encrypted_payload)}")
# Create the params
params = {
"dapp_encryption_public_key": base58.b58encode(PHANTOM_PUB_KEY.encode()).decode(),
"nonce": base58.b58encode(nonce).decode(),
"redirect_link": f"https://xxxx.ngrok-free.app/api/phantom-redirect",
"payload": base58.b58encode(encrypted_payload).decode(),
}
logger.info(f"Created params: {params}")
# Construct the deeplink
base_url = "https://phantom.app/ul/v1/signAndSendTransaction"
deeplink = f"{base_url}?{urllib.parse.urlencode(params)}"
logger.info(f"Constructed deeplink: {deeplink}")
return deeplink
except Exception as e:
logger.error(f"Error creating sign and send deeplink: {str(e)}")
logger.exception("Exception details:")
return None
My redirect_link endpoint is very simple, and takes the user back to the telegram channel
This error code and error message indicate that this issue is with phantom itself and not my implementation but it is hard to tell since the error message is so vague.
I need direction in this regard. Please let me know if there is any other information I can provide which would assist you in helping me!
Summary
I am following this guide
https://docs.phantom.app/phantom-deeplinks/provider-methods/signandsendtransaction
.I have a complete implementation for the creation of
Connect
andSignAndSendTransaction
deep links but I am getting an unhelpful error message fromSignAndSendTransaction
deep link:errorCode=-32603
anderrorMessage=Unexpected+error
.I see from this page
https://docs.phantom.app/solana/errors
that error-32603
is anInternal Server Error
andSomething went wrong within Phantom.
.That gives me almost nothing to go off. I have no idea if it is something I am doing wrong.
Connect deep link
Connect
deeplink by following this guidehttps://docs.phantom.app/phantom-deeplinks/provider-methods/connect
.phantom-callback
endpoint which accepts the response data from a successful connection using a deep link; look below and you can see the logs and code snippetsHere is the snippet of code which generated the logs above
SignAndSendTransaction
deeplinkSignAndSendTransaction
deeplinkCode snippet of my logic
My redirect_link endpoint is very simple, and takes the user back to the telegram channel
However, here is the issue:
This error code and error message indicate that this issue is with phantom itself and not my implementation but it is hard to tell since the error message is so vague.
I need direction in this regard. Please let me know if there is any other information I can provide which would assist you in helping me!
Thank you very much!
Example
No response
Steps to Reproduce
Phantom Version
24.13.0
Is there an existing discussion for this?