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", product=models.Product.EARN)

    # Handle response
    print(res)
{
  "transaction": {
    "chainId": "0x2105",
    "data": "0x6a761202000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda029130000000000000000000000000000000000000000000000000000000005f5e100",
    "from": "0x7B3B1F28a30276A21bE8e68E4C829972c7e641E7",
    "gas": "0x7a120",
    "maxFeePerGas": "0x59682f00",
    "maxPriorityFeePerGas": "0x3b9aca00",
    "nonce": "0x12",
    "to": "0x6B90E8B4E3E971E74C1A47a3a20976377E2dB4b1",
    "value": "0x0"
  }
}

Authorizations

x-api-key
string
header
required

Your Compass API Key. Get your key here.

Body

application/json
owner
string
default:0xCE1A77F0abff993d6d3D04d44b70831c6924fb40
required

The wallet address that owns the Product Account.

chain
enum<string>
default:arbitrum
required

Blockchain network

Available options:
base,
ethereum,
arbitrum
eip_712
BatchedSafeOperationsResponse · object
required

Response containing EIP-712 typed data for Safe transaction signing.

Example:
{
"domain": {
"chainId": 8453,
"verifyingContract": "0x6B90E8B4E3E971E74C1A47a3a20976377E2dB4b1"
},
"message": {
"baseGas": "0",
"data": "0x8d80ff0a0000000000000000000000000000000000000000000000000000000000000020",
"gasPrice": "0",
"gasToken": "0x0000000000000000000000000000000000000000",
"nonce": "7",
"operation": 1,
"refundReceiver": "0x0000000000000000000000000000000000000000",
"safeTxGas": "0",
"to": "0x93C23AAE4793C14D6DF35D2A2A2234204e1559dA",
"value": "0"
},
"primaryType": "SafeTx",
"types": {
"EIP712Domain": [
{ "name": "chainId", "type": "uint256" },
{
"name": "verifyingContract",
"type": "address"
}
],
"SafeTx": [
{ "name": "to", "type": "address" },
{ "name": "value", "type": "uint256" },
{ "name": "data", "type": "bytes" },
{ "name": "operation", "type": "uint8" },
{ "name": "safeTxGas", "type": "uint256" },
{ "name": "baseGas", "type": "uint256" },
{ "name": "gasPrice", "type": "uint256" },
{ "name": "gasToken", "type": "address" },
{
"name": "refundReceiver",
"type": "address"
},
{ "name": "nonce", "type": "uint256" }
]
}
}
signature
string
default:0x160d2709ae195f591daa33ad6ab1fb18b8762a39d8c4466c4cbe95cf6881fc3d54d469710ef0e7fd64ecff47c1ba5741d7254903bfaebdacea5aa8289f81ba9a1c
required

The EIP-712 signed typed data signature.

sender
string
default:0x02122Ac49b0Be2e0eAD957F2D080805A0127Aa9d
required

The address of the wallet which will send the transaction.

product
enum<string>
default:earn

Which product the gas sponsorship is for. Determines which Product Account (Safe) address to use.

Available options:
earn,
credit

Response

Successful Response

transaction
UnsignedTransaction · object
required

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

Example:
{
"chainId": "0x2105",
"data": "0x1688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000675f4a3d",
"from": "0x4A83b4413CF41C3244027e1590E35a0F48403F0c",
"gas": "0x7a120",
"maxFeePerGas": "0x59682f00",
"maxPriorityFeePerGas": "0x3b9aca00",
"nonce": "0x5",
"to": "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67",
"value": "0x0"
}