Skip to main content

Table of Contents

Module spoon_ai.tools.turnkey_tools

Turnkey Tools - Secure Blockchain Operations

This module provides Turnkey SDK tools for secure blockchain operations including:

  • Transaction signing and broadcasting
  • Message and EIP-712 signing
  • Multi-account management
  • Activity audit and monitoring
  • Wallet and account operations

TurnkeyBaseTool Objects​

class TurnkeyBaseTool(BaseTool)

Base class for Turnkey tools with shared client initialization

client​

@property
def client()

Lazy initialization of Turnkey client

SignEVMTransactionTool Objects​

class SignEVMTransactionTool(TurnkeyBaseTool)

Sign EVM transaction using Turnkey

execute​

async def execute(sign_with: str, unsigned_tx: str, **kwargs) -> str

Sign EVM transaction

SignMessageTool Objects​

class SignMessageTool(TurnkeyBaseTool)

Sign arbitrary message using Turnkey

execute​

async def execute(sign_with: str,
message: str,
use_keccak256: bool = True,
**kwargs) -> str

Sign message

SignTypedDataTool Objects​

class SignTypedDataTool(TurnkeyBaseTool)

Sign EIP-712 structured data using Turnkey

execute​

async def execute(sign_with: str, typed_data: dict, **kwargs) -> str

Sign EIP-712 typed data

BroadcastTransactionTool Objects​

class BroadcastTransactionTool(TurnkeyBaseTool)

Broadcast signed transaction to blockchain

execute​

async def execute(signed_tx: str, rpc_url: str = None, **kwargs) -> str

Broadcast transaction

ListWalletsTool Objects​

class ListWalletsTool(TurnkeyBaseTool)

List all wallets in the organization

execute​

async def execute(**kwargs) -> str

List wallets

ListWalletAccountsTool Objects​

class ListWalletAccountsTool(TurnkeyBaseTool)

List accounts for a specific wallet

execute​

async def execute(wallet_id: str,
limit: str = None,
before: str = None,
after: str = None,
**kwargs) -> str

List wallet accounts

GetActivityTool Objects​

class GetActivityTool(TurnkeyBaseTool)

Get activity details by ID

execute​

async def execute(activity_id: str, **kwargs) -> str

Get activity details

ListActivitiesTool Objects​

class ListActivitiesTool(TurnkeyBaseTool)

List recent activities in the organization

execute​

async def execute(limit: str = "10",
before: str = None,
after: str = None,
filter_by_status: list = None,
filter_by_type: list = None,
**kwargs) -> str

List activities

WhoAmITool Objects​

class WhoAmITool(TurnkeyBaseTool)

Get organization information

execute​

async def execute(**kwargs) -> str

Get organization info

BuildUnsignedEIP1559TxTool Objects​

class BuildUnsignedEIP1559TxTool(BaseTool)

Build unsigned EIP-1559 transaction (supports NeoX)

execute​

async def execute(from_addr: str,
to_addr: str = None,
value_wei: str = "0",
data_hex: str = "0x",
priority_gwei: str = "1",
max_fee_gwei: str = None,
gas_limit: str = None,
rpc_url: str = None,
**kwargs) -> str

Build unsigned transaction (auto-detects NeoX)

ListAllAccountsTool Objects​

class ListAllAccountsTool(TurnkeyBaseTool)

List all accounts across all wallets in the organization

execute​

async def execute(limit: str = "50", **kwargs) -> str

List all accounts across all wallets

BatchSignTransactionsTool Objects​

class BatchSignTransactionsTool(TurnkeyBaseTool)

Batch sign transactions for multiple accounts

execute​

async def execute(to_address: str,
value_wei: str,
data_hex: str = "0x",
max_accounts: str = "3",
enable_broadcast: bool = False,
rpc_url: str = None,
**kwargs) -> str

Batch sign transactions for multiple accounts

CreateWalletTool Objects​

class CreateWalletTool(TurnkeyBaseTool)

Create a new wallet

execute​

async def execute(wallet_name: str,
accounts_json: str = None,
mnemonic_length: str = "24",
**kwargs) -> str

Create a new wallet

GetWalletTool Objects​

class GetWalletTool(TurnkeyBaseTool)

Get wallet information by wallet ID

execute​

async def execute(wallet_id: str, **kwargs) -> str

Get wallet information

CreateWalletAccountsTool Objects​

class CreateWalletAccountsTool(TurnkeyBaseTool)

Add accounts to an existing wallet

execute​

async def execute(wallet_id: str, accounts_json: str, **kwargs) -> str

Add accounts to existing wallet

CompleteTransactionWorkflowTool Objects​

class CompleteTransactionWorkflowTool(TurnkeyBaseTool)

Complete transaction workflow: build, sign, and optionally broadcast

execute​

async def execute(sign_with: str,
to_address: str,
value_wei: str,
data_hex: str = "0x",
enable_broadcast: bool = False,
rpc_url: str = None,
**kwargs) -> str

Complete transaction workflow

get_turnkey_tools​

def get_turnkey_tools() -> List[BaseTool]

Get all Turnkey tools