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 | SignAndSendRequestInput) -> SignAndSendResponse

Ethereum (EVM Chains)

Request:
  • network (string): Network identifier
  • request (object):
    • to_address (Python) / toAddress (TypeScript): Recipient address (hex string)
    • data (string): Calldata (hex string, use “0x” for transfers)
    • value (string): Wei amount (string)
Example:
response = agent.sign_and_send({
    "network": "ethereum:1",
    "request": {
        "to_address": agent.sessionWalletAddress,
        "data": "0x",
        "value": "100000000000000",  # 0.0001 ETH
    },
})

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):
    • hex_transaction (Python) / hexTransaction (TypeScript): 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 | EvmMessageSignRequestInput) -> EvmMessageSignResponse
Python Request:
  • 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)
TypeScript Request: TypeScript wraps the same message payload in { network, request }. 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({
    "messageType": "eip191",
    "chainId": 1,
    "data": {"message": "Hello, world!"},
})
if result.success and result.data:
    agent.log(f"Signature: {result.data.formatted_signature}")
else:
    agent.log(result.error or "Signing failed", error=True)

Notes

  • signMessage is EVM-only. Solana message signing is not supported.
  • Manual mode: in a manual session the message is not signed by the agent run — it is captured as a suggestion for the user to approve (a strict safeguard: an agent run never signs autonomously). result.data is then a suggestion envelope ({ suggested: true, suggestionId }) rather than a signature. Use the same call in both modes; check "suggested" in result.data if you need to branch. See Manual vs Auto Mode.
  • Gas and fee estimation are handled automatically server-side.
  • Transaction confirmation is handled automatically server-side. The server waits for onchain confirmation and returns success: false with an error message if a transaction reverts.

See Also