You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upon trying to implemnt Jupiter Ultra API using this example standalone_script_examples/ultra-api/order-and-execute/main.py. It works from SOL to USDC (So11111111111111111111111111111111111111112 -> EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v), however when I try going back USDC -> SOL, I am getting the following error
signed_transaction = VersionedTransaction(raw_transaction.message, signers)
TypeError: argument 'keypairs': failed to extract enum Signer ('KeypairWrapper | PresignerWrapper | NullSignerWrapper')
- variant KeypairWrapper (KeypairWrapper): TypeError: failed to extract field Signer::KeypairWrapper.0, caused by TypeError: 'Signature' object cannot be converted to 'Keypair'
- variant PresignerWrapper (PresignerWrapper): TypeError: failed to extract field Signer::PresignerWrapper.0, caused by TypeError: 'Signature' object cannot be converted to 'Presigner'
- variant NullSignerWrapper (NullSignerWrapper): TypeError: failed to extract field Signer::NullSignerWrapper.0, caused by TypeError: 'Signature' object cannot be converted to 'NullSigner'
I have discovered that the issue is linked to the index of my (signer) wallet. When it's the first one (wallet_index == 0), it works. When wallet_index > 0 (aka wallet_index == 1) this issue occurs.
I have solved the error using a different approach, maybe it will help
defsign_transaction_v2(unsigned_transaction, wallet):
# Signers are the first N account keys, where N == len(signatures)account_keys=unsigned_transaction.message.account_keysnum_signers=len(unsigned_transaction.signatures)
# Locate our wallet among all account keyswallet_account_index=account_keys.index(wallet.pubkey())
# Ensure our wallet is actually a required signerifwallet_account_index>=num_signers:
raiseValueError(
f"Wallet pubkey is not in the required signers set "f"(wallet_index={wallet_account_index}, num_signers={num_signers})"
)
# Build signer list: NullSigner for everyone else, Keypair at our signer indexsigners= []
foriinrange(num_signers):
ifi==wallet_account_index:
signers.append(wallet)
else:
# NullSigner needs the corresponding signer pubkeysigners.append(NullSigner(account_keys[i]))
signed_tx=VersionedTransaction(unsigned_transaction.message, signers)
returnbase64.b64encode(bytes(signed_tx)).decode("utf-8")
Activity
fniko commentedon Oct 9, 2025
I have solved the error using a different approach, maybe it will help
fniko commentedon Oct 10, 2025
Similar issue Jupiter-DevRel/jup-python-sdk#3
cmoutafidis commentedon Nov 25, 2025
GM, I have made on the main branch on this script. Have a look if you can and let me know, I think this fixes the issue