Skip to main content
Formatting.
Source Link
steveluscher
  • 3.2k
  • 8
  • 38

I am using magicedens apiMagic Eden's API to generate a buy transaction, and it returns the bytes of the transaction. I'm using pythonPython, solanapysolanapy and solderssolders to send the transaction. However I don't know how to interpret the bytes and send them. Here is my code:

msg = VersionedTransaction.from_bytes(bytes(data[0]))
sig = wallet.sign_message(bytes(msg.message))
msg.verify_and_hash_message()
response = httpClient.send_transaction(
    txn=msg,
    opts=TxOpts(skip_preflight=False, skip_confirmation=True),
    )

Where data[0] is the list of bytes that is returned by magicedenMagic Eden. This code gives me the error:

msg.verify_and_hash_message()
solders.TransactionError: Transaction did not pass signature verification

If I remove the verify, it compiles but the signature is 1111....1111.....111.111 Any Any help is appreciated.

EDIT: I now have this, which seems to be very close to the actual solution however I'm getting this error New code:

raw_tx = VersionedTransaction.from_bytes(bytes(data[0]))
signature = wallet.sign_message(to_bytes_versioned(raw_tx.message))
signed_tx = VersionedTransaction.populate(raw_tx.message, [signature])

txid = httpClient.send_transaction(
        signed_tx,
        opts=TxOpts(skip_confirmation=False, skip_preflight=False),
    ).value
 

Error when sending transaction:

solana.rpc.core.RPCNoResultException: invalid transaction: Transaction failed to sanitize accounts offsets correctly

I am using magicedens api to generate a buy transaction, and it returns the bytes of the transaction. I'm using python, solanapy and solders to send the transaction. However I don't know how to interpret the bytes and send them. Here is my code:

msg = VersionedTransaction.from_bytes(bytes(data[0]))
sig = wallet.sign_message(bytes(msg.message))
msg.verify_and_hash_message()
response = httpClient.send_transaction(
    txn=msg, opts=TxOpts(skip_preflight=False, skip_confirmation=True),
    )

Where data[0] is the list of bytes that is returned by magiceden. This code gives me the error:

msg.verify_and_hash_message()
solders.TransactionError: Transaction did not pass signature verification

If I remove the verify, it compiles but the signature is 1111.....111 Any help is appreciated.

EDIT: I now have this, which seems to be very close to the actual solution however I'm getting this error New code:

raw_tx = VersionedTransaction.from_bytes(bytes(data[0]))
signature = wallet.sign_message(to_bytes_versioned(raw_tx.message))
signed_tx = VersionedTransaction.populate(raw_tx.message, [signature])

txid = httpClient.send_transaction(
        signed_tx,
        opts=TxOpts(skip_confirmation=False, skip_preflight=False),
    ).value
 

Error when sending transaction:

solana.rpc.core.RPCNoResultException: invalid transaction: Transaction failed to sanitize accounts offsets correctly

I am using Magic Eden's API to generate a buy transaction, and it returns the bytes of the transaction. I'm using Python, solanapy and solders to send the transaction. However I don't know how to interpret the bytes and send them. Here is my code:

msg = VersionedTransaction.from_bytes(bytes(data[0]))
sig = wallet.sign_message(bytes(msg.message))
msg.verify_and_hash_message()
response = httpClient.send_transaction(
    txn=msg,
    opts=TxOpts(skip_preflight=False, skip_confirmation=True),
)

Where data[0] is the list of bytes that is returned by Magic Eden. This code gives me the error:

msg.verify_and_hash_message()
solders.TransactionError: Transaction did not pass signature verification

If I remove the verify, it compiles but the signature is 1111.....111. Any help is appreciated.

EDIT: I now have this, which seems to be very close to the actual solution however I'm getting this error New code:

raw_tx = VersionedTransaction.from_bytes(bytes(data[0]))
signature = wallet.sign_message(to_bytes_versioned(raw_tx.message))
signed_tx = VersionedTransaction.populate(raw_tx.message, [signature])

txid = httpClient.send_transaction(
    signed_tx,
    opts=TxOpts(skip_confirmation=False, skip_preflight=False),
).value

Error when sending transaction:

solana.rpc.core.RPCNoResultException: invalid transaction: Transaction failed to sanitize accounts offsets correctly
added 648 characters in body
Source Link

I am using magicedens api to generate a buy transaction, and it returns the bytes of the transaction. I'm using python, solanapy and solders to send the transaction. However I don't know how to interpret the bytes and send them. Here is my code:

msg = VersionedTransaction.from_bytes(bytes(data[0]))
sig = wallet.sign_message(bytes(msg.message))
msg.verify_and_hash_message()
response = httpClient.send_transaction(
    txn=msg, opts=TxOpts(skip_preflight=False, skip_confirmation=True),
    )

Where data[0] is the list of bytes that is returned by magiceden. This code gives me the error:

msg.verify_and_hash_message()
solders.TransactionError: Transaction did not pass signature verification

If I remove the verify, it compiles but the signature is 1111.....111 Any help is appreciated.

EDIT: I now have this, which seems to be very close to the actual solution however I'm getting this error New code:

raw_tx = VersionedTransaction.from_bytes(bytes(data[0]))
signature = wallet.sign_message(to_bytes_versioned(raw_tx.message))
signed_tx = VersionedTransaction.populate(raw_tx.message, [signature])

txid = httpClient.send_transaction(
        signed_tx,
        opts=TxOpts(skip_confirmation=False, skip_preflight=False),
    ).value

Error when sending transaction:

solana.rpc.core.RPCNoResultException: invalid transaction: Transaction failed to sanitize accounts offsets correctly

I am using magicedens api to generate a buy transaction, and it returns the bytes of the transaction. I'm using python, solanapy and solders to send the transaction. However I don't know how to interpret the bytes and send them. Here is my code:

msg = VersionedTransaction.from_bytes(bytes(data[0]))
sig = wallet.sign_message(bytes(msg.message))
msg.verify_and_hash_message()
response = httpClient.send_transaction(
    txn=msg, opts=TxOpts(skip_preflight=False, skip_confirmation=True),
    )

Where data[0] is the list of bytes that is returned by magiceden. This code gives me the error:

msg.verify_and_hash_message()
solders.TransactionError: Transaction did not pass signature verification

If I remove the verify, it compiles but the signature is 1111.....111 Any help is appreciated.

I am using magicedens api to generate a buy transaction, and it returns the bytes of the transaction. I'm using python, solanapy and solders to send the transaction. However I don't know how to interpret the bytes and send them. Here is my code:

msg = VersionedTransaction.from_bytes(bytes(data[0]))
sig = wallet.sign_message(bytes(msg.message))
msg.verify_and_hash_message()
response = httpClient.send_transaction(
    txn=msg, opts=TxOpts(skip_preflight=False, skip_confirmation=True),
    )

Where data[0] is the list of bytes that is returned by magiceden. This code gives me the error:

msg.verify_and_hash_message()
solders.TransactionError: Transaction did not pass signature verification

If I remove the verify, it compiles but the signature is 1111.....111 Any help is appreciated.

EDIT: I now have this, which seems to be very close to the actual solution however I'm getting this error New code:

raw_tx = VersionedTransaction.from_bytes(bytes(data[0]))
signature = wallet.sign_message(to_bytes_versioned(raw_tx.message))
signed_tx = VersionedTransaction.populate(raw_tx.message, [signature])

txid = httpClient.send_transaction(
        signed_tx,
        opts=TxOpts(skip_confirmation=False, skip_preflight=False),
    ).value

Error when sending transaction:

solana.rpc.core.RPCNoResultException: invalid transaction: Transaction failed to sanitize accounts offsets correctly
Source Link

How to send versioned transaction from bytes

I am using magicedens api to generate a buy transaction, and it returns the bytes of the transaction. I'm using python, solanapy and solders to send the transaction. However I don't know how to interpret the bytes and send them. Here is my code:

msg = VersionedTransaction.from_bytes(bytes(data[0]))
sig = wallet.sign_message(bytes(msg.message))
msg.verify_and_hash_message()
response = httpClient.send_transaction(
    txn=msg, opts=TxOpts(skip_preflight=False, skip_confirmation=True),
    )

Where data[0] is the list of bytes that is returned by magiceden. This code gives me the error:

msg.verify_and_hash_message()
solders.TransactionError: Transaction did not pass signature verification

If I remove the verify, it compiles but the signature is 1111.....111 Any help is appreciated.