-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_bridge.py
More file actions
63 lines (53 loc) · 1.85 KB
/
test_bridge.py
File metadata and controls
63 lines (53 loc) · 1.85 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
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
"""
Simple test script to verify the Node.js bridge works
"""
import sys
import os
from pathlib import Path
# Add src to path
sys.path.insert(0, str(Path(__file__).parent / "src"))
from vortex_sdk import VortexSDK, FiatToken, EvmToken, Networks
def test_basic_connection():
"""Test basic SDK connection without network calls"""
print("=" * 60)
print("Testing Vortex SDK Python Wrapper - Node.js Bridge")
print("=" * 60)
# Create SDK instance with minimal config to avoid network init
config = {
"apiBaseUrl": "https://api.vortex.pendulumchain.org",
# Disable auto-reconnect to avoid WebSocket blocking
"autoReconnect": False,
}
print("\n1. Creating SDK instance...")
try:
sdk = VortexSDK(config)
print(" ✓ SDK instance created successfully")
except Exception as e:
print(f" ✗ Failed to create SDK: {e}")
return False
# Test a simple API call (quote creation)
print("\n2. Testing quote creation...")
try:
quote_request = {
"from": "pix",
"inputAmount": "100000", # 1000 BRL
"inputCurrency": FiatToken.BRL,
"outputCurrency": EvmToken.USDC,
"rampType": "on",
"to": Networks.Polygon,
}
print(f" Request: {quote_request}")
quote = sdk.create_quote(quote_request)
print(f" ✓ Quote created successfully")
print(f" Quote ID: {quote.get('id', 'N/A')}")
print(f" Output Amount: {quote.get('outputAmount', 'N/A')}")
return True
except Exception as e:
print(f" ✗ Failed to create quote: {e}")
import traceback
traceback.print_exc()
return False
if __name__ == "__main__":
success = test_basic_connection()
sys.exit(0 if success else 1)