ton_ai_tools 0.0.1
ton_ai_tools: ^0.0.1 copied to clipboard
AI-callable Flutter/Dart SDK powered by ton_dart for TONAPI and TonCenter wallet/blockchain tooling.
ton_ai_tools #
ton_ai_tools is an open-source Flutter/Dart SDK that turns TON data operations into AI-callable tools.
It is built on top of ton_dart 2.2.0 and uses its native TONAPI and TonCenter request models instead of implementing a custom TONAPI client.
What You Get #
- Wallet insights (TONAPI + TonCenter)
- Blockchain queries (transactions, traces, masterchain head)
- Event explanation (action-level summaries for LLM output)
- Safe transaction preparation (wallet emulation + risk grading)
- JSON-schema tool definitions ready for LLM function/tool calling
Install #
dependencies:
ton_ai_tools: <your-version>
Quick Start #
import 'package:ton_ai_tools/ton_ai_tools.dart';
final client = TonDataClient.forNetwork(
TonNetwork.mainnet,
tonApiBearerToken: 'YOUR_TONAPI_BEARER',
tonCenterApiKey: 'YOUR_TONCENTER_API_KEY',
);
final toolkit = TonAiToolkit(gateway: client);
final tools = toolkit.openAiToolDefinitions; // Pass to your LLM runtime.
final walletInsights = await toolkit.invoke(
TonAiToolkit.walletInsightsTool,
{'account_id': '0:...'},
);
final safePrep = await toolkit.invoke(
TonAiToolkit.prepareWalletTxTool,
{'boc': 'te6cck...'},
);
flutter_ai_toolkit Integration #
You can use TON tools directly with flutter_ai_toolkit's FirebaseProvider
function-calling flow:
import 'package:firebase_ai/firebase_ai.dart';
import 'package:flutter_ai_toolkit/flutter_ai_toolkit.dart';
import 'package:ton_ai_tools/ton_ai_tools.dart';
final tonClient = TonDataClient.forNetwork(
TonNetwork.mainnet,
tonApiBearerToken: 'YOUR_TONAPI_BEARER',
tonCenterApiKey: 'YOUR_TONCENTER_API_KEY',
);
final tonToolkit = TonAiToolkit(gateway: tonClient);
final bridge = TonFlutterAiToolkitBridge(toolkit: tonToolkit);
final model = FirebaseAI.googleAI().generativeModel(
model: 'gemini-2.5-flash',
tools: bridge.firebaseTools(),
);
final provider = FirebaseProvider(
model: model,
onFunctionCall: bridge.onFunctionCall,
);
Direct Gateway Usage #
final head = await client.getBlockchainMasterchainHead();
final event = await client.getEvent(eventId: '...');
final seqno = await client.getAccountSeqno('0:...');
Built-In Tool Names #
ton_wallet_insightston_wallet_assetston_wallet_eventston_blockchain_masterchain_headton_blockchain_transactionton_blockchain_account_transactionston_trace_lookupton_event_explainton_prepare_wallet_transactionton_emulate_eventton_decode_boc_message