@@ -9,7 +9,7 @@ import os
99
1010from cryptobot import CryptoBotClient
1111from cryptobot.errors import CryptoBotError
12- from cryptobot.models import Asset, ButtonName, Status
12+ from cryptobot.models import Asset, ButtonName, CheckStatus, Status
1313
1414client = CryptoBotClient(api_token = os.environ[" CRYPTOBOT_API_TOKEN" ])
1515```
@@ -218,6 +218,97 @@ listener = Listener(
218218listener.listen()
219219```
220220
221+ ## Airdrop with Crypto Checks
222+
223+ Create checks for a batch of users and track activations.
224+
225+ ``` python
226+ from cryptobot.models import Asset
227+
228+
229+ def airdrop_checks (client : CryptoBotClient, user_ids : list , amount : float , asset : Asset = Asset.USDT ):
230+ """ Create pinned checks for a list of users."""
231+ results = []
232+ for user_id in user_ids:
233+ try :
234+ check = client.create_check(
235+ asset = asset,
236+ amount = amount,
237+ pin_to_user_id = user_id,
238+ )
239+ results.append({" user_id" : user_id, " check_id" : check.check_id, " url" : check.bot_check_url})
240+ except CryptoBotError as exc:
241+ results.append({" user_id" : user_id, " error" : f " { exc.code} : { exc.name} " })
242+ return results
243+
244+
245+ def check_activations (client : CryptoBotClient, asset : Asset = Asset.USDT ):
246+ """ Report activated vs active checks."""
247+ checks = client.get_checks(asset = asset)
248+ activated = [c for c in checks if c.activated_at is not None ]
249+ pending = [c for c in checks if c.activated_at is None ]
250+ return {" activated" : len (activated), " pending" : len (pending), " total" : len (checks)}
251+
252+
253+ # Usage
254+ recipients = [111111 , 222222 , 333333 ]
255+ drops = airdrop_checks(client, recipients, amount = 0.5 , asset = Asset.TON )
256+ for drop in drops:
257+ print (drop)
258+
259+ print (" Status:" , check_activations(client, Asset.TON ))
260+ ```
261+
262+ ## App Stats Dashboard
263+
264+ Pull statistics and display a summary report.
265+
266+ ``` python
267+ def stats_report (client : CryptoBotClient, start_at : str = None , end_at : str = None ):
268+ """ Print a summary of app statistics."""
269+ stats = client.get_stats(start_at = start_at, end_at = end_at)
270+ print (f " Volume: { stats.volume} " )
271+ print (f " Conversion: { stats.conversion} " )
272+ print (f " Unique users: { stats.unique_users_count} " )
273+ print (f " Invoices created: { stats.created_invoice_count} " )
274+ print (f " Invoices paid: { stats.paid_invoice_count} " )
275+ print (f " Period: { stats.start_at} to { stats.end_at} " )
276+
277+
278+ # Last 7 days
279+ stats_report(client, start_at = " 2026-03-11T00:00:00Z" , end_at = " 2026-03-18T00:00:00Z" )
280+ ```
281+
282+ ## Transfer Ledger
283+
284+ Scan outgoing transfers and build a local ledger.
285+
286+ ``` python
287+ from decimal import Decimal
288+
289+
290+ def transfer_ledger (client : CryptoBotClient, asset : Asset = None ):
291+ """ Build a ledger of all outgoing transfers."""
292+ ledger = []
293+ for transfer in client.iter_transfers(asset = asset, page_size = 200 ):
294+ ledger.append({
295+ " id" : transfer.transfer_id,
296+ " user_id" : transfer.user_id,
297+ " asset" : transfer.asset.name,
298+ " amount" : transfer.amount,
299+ " status" : transfer.status.name,
300+ " spend_id" : transfer.spend_id,
301+ " completed_at" : transfer.completed_at,
302+ })
303+
304+ total = sum (Decimal(str (t[" amount" ])) for t in ledger)
305+ return {" entries" : ledger, " total" : str (total), " count" : len (ledger)}
306+
307+
308+ result = transfer_ledger(client, asset = Asset.TON )
309+ print (f " Total transferred: { result[' total' ]} ( { result[' count' ]} transfers) " )
310+ ```
311+
221312## Testnet Smoke Check
222313
223314Quick validation script for non-production environments.
0 commit comments