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>"
}
}Prepare a gas-sponsored transaction to be signed and submitted by sender.
The owner submits their off-chain signature of EIP-712 typed data along with the data itself.
The sender will sign and submit the transaction returned from this endpoint, effectively sponsoring the gas for the transaction on behalf of the owner.
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>"
}
}The owner of the smart account's address.
Blockchain network
base, ethereum, arbitrum The EIP-712 typed data that was signed.
Show child attributes
EIP-712 type definitions
Show child attributes
Primary type for the structured data
"SafeTx"Safe transaction message data
Show child attributes
Destination address
Value in wei as a string
Transaction data as hex string
Operation type (0=Call, 1=DelegateCall)
0, 1 Gas for the Safe transaction
Base gas costs
Gas price
Token address for gas payment
Address to receive gas refund
Safe transaction nonce
The EIP-712 signed typed data signature.
The address of the wallet which will send the transaction.
Successful Response
Transaction to be signed & submitted via the sender to the network.
Show child attributes
The chain id of the transaction
The data of the transaction
The sender of the transaction
The gas of the transaction
The recipient of the transaction
The value of the transaction
The nonce of the address
The max fee per gas of the transaction
The max priority fee per gas of the transaction
Was this page helpful?