(transaction_bundler)
- transaction_bundler_authorization - Enable Transaction Bundling
- transaction_bundler_execute - Construct Bundled Transaction
- transaction_bundler_aave_loop - AAVE Leverage Long/Short
Get authorization for bundling transactions.
Currently this is required for every transaction bundle to prevent replay attacks and ensure transaction ordering when batching multiple actions into a single transaction. The authorization includes a nonce and chain ID to guarantee transaction uniqueness and proper network targeting.
from compass_api_sdk import CompassAPI, models
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.transaction_bundler.transaction_bundler_authorization(chain=models.MulticallAuthorizationRequestChain.ARBITRUM, sender="0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B")
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
chain |
models.MulticallAuthorizationRequestChain | ✔️ | N/A | |
sender |
str | ✔️ | The Ethereum address to use for authorization | 0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.MulticallAuthorizationResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
Bundle arbitrary transactions together into a single multicall transaction using EIP-7702.
This endpoint allows bundling multiple contract calls into a single atomic transaction, reducing gas costs and ensuring all operations succeed or fail together. The transaction must be authorized using the /authorization endpoint to prevent replay attacks.
from compass_api_sdk import CompassAPI, models
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.transaction_bundler.transaction_bundler_execute(chain=models.MulticallExecuteRequestChain.ETHEREUM, sender="0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B", actions=[
models.UserOperation(
body=models.SetAllowanceParams(
token="WETH",
contract=models.SetAllowanceParamsContractEnum.UNISWAP_V3_ROUTER,
amount="1000",
),
),
], estimate_gas=True, signed_authorization={
"nonce": 1000,
"address": "0xcA11bde05977b3631167028862bE2a173976CA11",
"chain_id": 42161,
"r": "0x5f9f3f3226ac91bc01a72dd117141f6c6de1ed30d3af9f95c3423316dc21d615",
"s": "0x78f7982ede9dabc53d7153974c5692fda8a21fc73bdafc42aaf135505e22817c",
"y_parity": 0,
})
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
chain |
models.MulticallExecuteRequestChain | ✔️ | N/A | |
sender |
str | ✔️ | The address of the transaction sender. | 0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B |
actions |
List[models.UserOperation] | ✔️ | List of possible actions for multicall | { "body": { "action_type": "SET_ALLOWANCE", "amount": "1000", "contract": "UniswapV3Router", "token": "WETH" } } |
estimate_gas |
Optional[bool] | ➖ | Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed. | |
signed_authorization |
OptionalNullable[models.SignedAuthorization] | ➖ | EIP-7702 authorization | { "address": "0xcA11bde05977b3631167028862bE2a173976CA11", "chainId": 42161, "nonce": 1000, "r": "0x5f9f3f3226ac91bc01a72dd117141f6c6de1ed30d3af9f95c3423316dc21d615", "s": "0x78f7982ede9dabc53d7153974c5692fda8a21fc73bdafc42aaf135505e22817c", "yParity": 0 } |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.BundlerTransactionResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
Execute an Aave looping strategy that involves repeated supply and borrow operations.
This endpoint creates a multicall transaction that performs a series of operations:
- Approves and supplies initial token
- For each loop:
- Borrows another token
- Swaps borrowed token back to supply token
- Supplies the swapped tokens
The transaction must be authorized using the /authorization endpoint to prevent replay attacks.
from compass_api_sdk import CompassAPI, models
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.transaction_bundler.transaction_bundler_aave_loop(chain=models.AaveLoopRequestChain.BASE, sender="0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B", collateral_token="USDC", borrow_token="WETH", initial_collateral_amount="1000", multiplier="2.5", max_slippage_percent=2.5, loan_to_value=20.5, estimate_gas=True, signed_authorization={
"nonce": 1000,
"address": "0xcA11bde05977b3631167028862bE2a173976CA11",
"chain_id": 42161,
"r": "0x5f9f3f3226ac91bc01a72dd117141f6c6de1ed30d3af9f95c3423316dc21d615",
"s": "0x78f7982ede9dabc53d7153974c5692fda8a21fc73bdafc42aaf135505e22817c",
"y_parity": 0,
}, is_account_abstraction=True)
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
chain |
models.AaveLoopRequestChain | ✔️ | N/A | |
sender |
str | ✔️ | The address of the transaction sender. | 0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B |
collateral_token |
str | ✔️ | Symbol or address of token to supply to Aave.. | USDC |
borrow_token |
str | ✔️ | Symbol or address of token to borrow from Aave.. | WETH |
initial_collateral_amount |
models.InitialCollateralAmount | ✔️ | Amount of collateral token to supply to Aave | 1000 |
multiplier |
models.Multiplier | ✔️ | Leverage multiplier. Total loop collateral will be calculated as multiplier x initial_collateral_amount |
2.5 |
max_slippage_percent |
models.MaxSlippagePercent | ✔️ | Maximum allowed slippage for token swaps in percentage | 2.5 |
loan_to_value |
models.LoanToValue | ✔️ | Loan To Value percentage of the loop | 20.5 |
estimate_gas |
Optional[bool] | ➖ | Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed. | |
signed_authorization |
OptionalNullable[models.SignedAuthorization] | ➖ | EIP-7702 authorization. Required when is_account_abstraction is False. |
{ "address": "0xcA11bde05977b3631167028862bE2a173976CA11", "chainId": 42161, "nonce": 1000, "r": "0x5f9f3f3226ac91bc01a72dd117141f6c6de1ed30d3af9f95c3423316dc21d615", "s": "0x78f7982ede9dabc53d7153974c5692fda8a21fc73bdafc42aaf135505e22817c", "yParity": 0 } |
is_account_abstraction |
Optional[bool] | ➖ | Whether to use account abstraction for the transaction. | true |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.ResponseV1TransactionBundlerAaveLoop
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |