Skip to content

Latest commit

 

History

History
59 lines (41 loc) · 5.95 KB

File metadata and controls

59 lines (41 loc) · 5.95 KB

SmartAccount

(smart_account)

Overview

Available Operations

smart_account_batched_user_operations

Generate a list of user operations for smart account batching.

Example Usage

from compass_api_sdk import CompassAPI, models


with CompassAPI(
    api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:

    res = compass_api.smart_account.smart_account_batched_user_operations(chain=models.BatchedUserOperationsRequestChain.ARBITRUM, sender="0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B", operations=[
        models.UserOperation(
            body=models.SetAllowanceParams(
                token="USDC",
                contract=models.SetAllowanceParamsContractEnum.UNISWAP_V3_ROUTER,
                amount="1000",
            ),
        ),
    ], estimate_gas=True)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
chain models.BatchedUserOperationsRequestChain ✔️ N/A
sender str ✔️ The address of the transaction sender. 0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B
operations List[models.UserOperation] ✔️ List of possible user operations {
"body": {
"action_type": "SET_ALLOWANCE",
"amount": "1000",
"contract": "UniswapV3Router",
"token": "USDC"
}
}
estimate_gas Optional[bool] Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.BatchedUserOperationsResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.APIError 4XX, 5XX */*