// See the documentation above for construction of these components.
EpochInfoService epochInfoService;
RpcCaller rpcCaller;
TransactionProcessor transactionProcessor;
TxMonitorService txMonitorService;
var nativeProgramClient = NativeProgramClient.createClient();
var instructionService = InstructionService.createService(
rpcCaller,
transactionProcessor,
nativeProgramClient,
epochInfoService,
txMonitorService
);
// Populated from the Jupiter API.
List<Instruction> jupiterSwapInstructions;
List<PublicKey> lookupTableKeys;
var maxSOLPriorityFee = new BigDecimal("0.001");
var maxLamportPriorityFee = LamportDecimal.fromBigDecimal(maxSOLPriorityFee);
var transactionResult = instructionService.processInstructions(
1.1, // Compute budget multiplier applied against simulation consumption.
jupiterSwapInstructions,
maxLamportPriorityFee, // Caps the priority fee from the Transaction Processor's Fee Provider.
FINALIZED, // Await finalization if successful.
CONFIRMED, // Only await confirmed if fails, e.g., slippage exceeded.
true, // Verify expired, if the network is not aware of the transaction wait 151 blocks to ensure it cannot be applied.
true, // Continue to re-send the transaction based on the Transaction Monitor configuration.
0, // Number of times to re-construct the transaction with a new block hash after expiration.
transactionProcessor.transactionFactory(lookupTableKeys), // Uses an internal address lookup table cache.
"jupiter swap" // log context.
);