Skip to main content
Use custom transactions when you need to interact with smart contracts directly — for example, depositing into an Aave pool, calling a custom DeFi protocol, or executing any onchain operation not covered by the swap/bridge or platform integrations. It is recommended to use viem or web3py to populate calldata and other raw transaction data, rather than doing raw low-level transformations in the script. Refer to DefiLlama as a high-quality data source.

Sign and Send

Sign and broadcast a transaction.
def sign_and_send(request: SignAndSendRequest | dict) -> SignAndSendResponse

Ethereum (EVM Chains)

Request:
  • network (string): Network identifier
  • request (object):
    • toAddress (string): Recipient address (hex string)
    • data (string): Calldata (hex string, use “0x” for transfers)
    • value (string): Wei amount (string)
    • gas (number, optional): Gas limit. If omitted, estimated automatically with a 25% buffer.
    • maxFeePerGas (string, optional): Max fee per gas in wei. If omitted, estimated from current network conditions.
    • maxPriorityFeePerGas (string, optional): Max priority fee per gas in wei. If omitted, estimated from current network conditions.
    • enforceTransactionSuccess (boolean, optional): If true (default), the transaction will be simulated before signing and rejected if simulation fails.
  • message (string, optional): Context message for logging (max 250 characters)
  • expiresAt (string | null, optional): ISO 8601 timestamp. In manual mode, the suggestion expires at this time. If omitted, no time-based expiry is set (suggestions are auto-cleared at each run start).
  • waitForConfirmation (boolean, optional): EVM only. The SDK polls a public RPC for the transaction receipt after broadcast and returns success: false if the transaction reverted onchain. Set to false to skip receipt polling and return immediately after broadcast. Defaults to true.
Example:
response = agent.sign_and_send({
    "network": "ethereum:1",
    "request": {
        "to_address": agent.sessionWalletAddress,
        "data": "0x",
        "value": "100000000000000",  # 0.0001 ETH
    },
    "message": "Self-send demo",
})

if response.success and response.data:
    agent.log(f"Transaction sent: {response.data.tx_hash}")
    if response.data.transaction_url:
        agent.log(f"View: {response.data.transaction_url}")
else:
    agent.log(response.error or "Transaction failed", error=True)

Solana

Request:
  • network (string): “solana”
  • request (object):
    • hexTransaction (string): Serialized VersionedTransaction as hex string
Example:
response = agent.sign_and_send({
    "network": "solana",
    "request": {
        "hex_transaction": "010001030a0b..."  # Serialized transaction
    }
})

if response.success and response.data:
    agent.log(f"Transaction: {response.data.tx_hash}")
Response:
  • success (boolean): Whether the transaction was signed and broadcast
  • data.txHash / data.tx_hash (string): Transaction hash (on success)
  • data.transactionUrl / data.transaction_url (string, optional): Explorer link (on success)
  • error (string | null): Error message (on failure)

Sign Message

Sign a message on an EVM network (EIP-712 or EIP-191).
def sign_message(request: EvmMessageSignRequest | dict) -> EvmMessageSignResponse
Request:
  • network (string): “ethereum:chainId” for EVM networks
  • request (object):
    • messageType (string): “eip712” or “eip191”
    • chainId (number): Ethereum chain ID
    • data (object): Message data structure
      • For EIP-712: { domain, types, primaryType, message }
      • For EIP-191: { message } (plain text)
Response:
  • success (boolean): Whether the message was signed
  • data (object): Signature data (on success)
    • v (number): Signature v component
    • r (string): Signature r component (hex)
    • s (string): Signature s component (hex)
    • formattedSignature (string): Complete signature (hex)
    • type (string): Always “evm”
  • error (string | null): Error message (on failure)
Example:
# EIP-191 simple message
result = agent.sign_message({
    "network": "ethereum:1",
    "request": {
        "messageType": "eip191",
        "chainId": 1,
        "data": {"message": "Hello, world!"}
    }
})
if result.success and result.data:
    agent.log(f"Signature: {result.data.formattedSignature}")
else:
    agent.log(result.error or "Signing failed", error=True)

Notes

  • signMessage is EVM-only. Solana message signing is not supported.
  • Gas estimation: When gas, maxFeePerGas, and maxPriorityFeePerGas are omitted, the execution layer estimates them automatically. Gas limits include a 25% buffer over the simulation estimate.
  • enforceTransactionSuccess defaults to true. Set to false only if you expect the transaction to revert in simulation but still want to submit it (rare).
  • waitForConfirmation (default true) polls a public RPC for the transaction receipt (up to 30 seconds). If the transaction reverts onchain, the response returns success: false with an error. Set to false when you don’t need to wait for confirmation — for example, fire-and-forget transactions where you’ll check the result later.

See Also