I have a serialized transaction from the Jupiter Swap API from which I can create a versioned transaction.
raw_tx = VersionedTransaction.from_bytes(base64.b64decode(serialized_transaction))
But I want to add priority fees my transaction, I use the following to create the instruction:
priorityFee = set_compute_unit_price(100000)
Since the priority fee would look like this when printed out:
Instruction { program_id: ComputeBudget111111111111111111111111111111, accounts: [], data: [3, 160, 134, 1, 0, 0, 0, 0, 0] }
How would I add this to my versioned transaction which looks like this:
Message { header: MessageHeader { num_required_signatures: 2, num_readonly_signed_accounts: 1, num_readonly_unsigned_accounts: 6 }, account_keys: [FerNfB9EMGLgdKMsQpP8Q5hzQLhcQUXGRc1wuC5Ybq3Y, HVcqYDdERth6wcemnvejAY6X2AWZaex31o94TsboRfjT, 9D5b1NHqqveAF4LTTXXJJbm5mnh3ugQ2jzRu1T3auQjd, GmnWWYa4gcZihoHeNpChSF9Lq8nfSMz4AJPzC2sawSAV, GTNw5SSuVxcdGZHdKuzx7qguS6JEcQV9oSVw8vCLqfwt, 11111111111111111111111111111111, 7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr, jupoNjAxXgZ4rjzxzPMP4oxduvQsQtZzyknqvzYNrNu, So11111111111111111111111111111111111111112, SysvarRent111111111111111111111111111111111, TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA], recent_blockhash: 3ShkR1fNXRxJV4aPtUApN6rRb6HHY8VwbGohu29RrsmQ, instructions: [CompiledInstruction { program_id_index: 7, accounts: [1, 0, 3, 4, 2, 8, 2, 7, 6, 5, 10, 9], data: [133, 110, 74, 175, 112, 159, 245, 159, 0, 45, 49, 1, 0, 0, 0, 0, 0, 48, 239, 125, 186, 2, 0, 0, 0] }] }
Do I have to create a new transaction from scratch or is there a way I can append it to the existing transaction?