Skip to main content
POST
/
v2
/
gas_sponsorship
/
prepare
Python (SDK)
from compass_api_sdk import CompassAPI, models


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

    res = compass_api.gas_sponsorship.gas_sponsorship_prepare(owner="0xCE1A77F0abff993d6d3D04d44b70831c6924fb40", chain=models.Chain.ARBITRUM, eip_712={
        "domain": {
            "name": "USD Coin",
            "version": "2",
            "chain_id": 42161,
            "verifying_contract": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
        },
        "types": {
            "eip712_domain": [
                {
                    "name": "name",
                    "type": "string",
                },
                {
                    "name": "version",
                    "type": "string",
                },
                {
                    "name": "chainId",
                    "type": "uint256",
                },
                {
                    "name": "verifyingContract",
                    "type": "address",
                },
            ],
            "permit": [
                {
                    "name": "owner",
                    "type": "address",
                },
                {
                    "name": "spender",
                    "type": "address",
                },
                {
                    "name": "value",
                    "type": "uint256",
                },
                {
                    "name": "nonce",
                    "type": "uint256",
                },
                {
                    "name": "deadline",
                    "type": "uint256",
                },
            ],
        },
        "primary_type": "Permit",
        "message": {
            "owner": "0xCE1A77F0abff993d6d3D04d44b70831c6924fb40",
            "spender": "0x000000000022D473030F116dDEE9F6B43aC78BA3",
            "value": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
            "nonce": "0",
            "deadline": "1762269774",
        },
    }, signature="0x160d2709ae195f591daa33ad6ab1fb18b8762a39d8c4466c4cbe95cf6881fc3d54d469710ef0e7fd64ecff47c1ba5741d7254903bfaebdacea5aa8289f81ba9a1c", sender="0x02122Ac49b0Be2e0eAD957F2D080805A0127Aa9d")

    # Handle response
    print(res)
{
  "transaction": {
    "chainId": "<string>",
    "data": "<string>",
    "from": "<string>",
    "gas": "<string>",
    "to": "<string>",
    "value": "<string>",
    "nonce": "<string>",
    "maxFeePerGas": "<string>",
    "maxPriorityFeePerGas": "<string>"
  }
}

Authorizations

x-api-key
string
header
required

Your Compass API Key. Get your key here.

Body

application/json
owner
string
required

The owner of the smart account's address.

chain
enum<string>
required

Blockchain network

Available options:
base,
ethereum,
arbitrum
eip_712
object
required

The EIP-712 typed data that was signed. Response containing EIP-712 typed data for Safe transaction signing.

  • BatchedSafeOperationsResponse
  • PermitTypedDataResponse
  • Permit2TypedData
signature
string
required

The EIP-712 signed typed data signature.

sender
string
required

The address of the wallet which will send the transaction.

Response

Successful Response

transaction
object
required

Transaction to be signed & submitted via the sender to the network.