-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.py
More file actions
51 lines (40 loc) · 1.24 KB
/
main.py
File metadata and controls
51 lines (40 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""
CDP Wallet Python Demo
======================
Main orchestration file that demonstrates:
1. Creating accounts (Alice and Bob)
2. Funding accounts
3. Sending transactions between accounts
"""
import asyncio
from accounts import create_accounts
from send_transaction import send_tokens
from utils import fund_account_from_faucet, fetch_balance, close_cdp_client
async def main():
"""
Main orchestration function
"""
try:
# Create accounts
alice, bob = await create_accounts()
# Fund Alice
# await fund_account_from_faucet(alice.address)
# Initial balances
print("\nInitial Balances:")
await fetch_balance(alice.address)
await fetch_balance(bob.address)
# Send transaction
print("\nSending Transaction:")
await send_tokens(alice, bob, amount_eth=0.001)
# Final balances
print("\nFinal Balances:")
await fetch_balance(alice.address)
await fetch_balance(bob.address)
except Exception as e:
print(f"Error: {str(e)}")
import traceback
traceback.print_exc()
finally:
await close_cdp_client()
if __name__ == "__main__":
asyncio.run(main())