Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make dynamic compute limit configurable #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/jupiter_python_sdk/jupiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,8 @@ async def swap(
as_legacy_transaction: bool=False,
exclude_dexes: list=None,
max_accounts: int=None,
platform_fee_bps: int=None
platform_fee_bps: int=None,
dynamic_compute_limit: bool=False
) -> str:
"""Perform a swap.

Expand All @@ -667,7 +668,8 @@ async def swap(
``as_legacy_transaction (bool)``: Default is False. Instead of using versioned transaction, this will use the legacy transaction.\n
``exclude_dexes (list)``: Default is that all DEXes are included. You can pass in the DEXes that you want to exclude in a list. For example, ['Aldrin','Saber'].\n
``max_accounts (int)``: Find a route given a maximum number of accounts involved, this might dangerously limit routing ending up giving a bad price. The max is an estimation and not the exact count.\n
``platform_fee_bps (int)``: If you want to charge the user a fee, you can specify the fee in BPS. Fee % is taken out of the output token.
``platform_fee_bps (int)``: If you want to charge the user a fee, you can specify the fee in BPS. Fee % is taken out of the output token.\n
``dynamic_compute_limit (bool)``: Enable dynamic compute limit for the transaction. Default is False.

Returns:
``str``: returns serialized transactions to perform the swap from https://quote-api.jup.ag/v6/swap
Expand Down Expand Up @@ -701,7 +703,8 @@ async def swap(
transaction_parameters = {
"quoteResponse": quoteResponse,
"userPublicKey": self.keypair.pubkey().__str__(),
"wrapAndUnwrapSol": wrap_unwrap_sol
"wrapAndUnwrapSol": wrap_unwrap_sol,
"dynamicComputeUnitLimit": dynamic_compute_limit
}
if prioritization_fee_lamports:
transaction_parameters.update({"prioritizationFeeLamports": prioritization_fee_lamports})
Expand Down