#!/usr/bin/env npx tsx /** * Quick Start Script for Credential Manager * * Run this script to see the credential manager in action: * npx tsx scripts/run-credential-manager-demo.ts */ import { CredentialManager } from '../src/core/credential-manager/CredentialManager' import { Platform } from '../src/types/credential' import { TradingOperation } from '../src/core/credential-manager/TradingIntegration' async function quickDemo() { console.log('šŸš€ Quick Credential Manager Demo\n') // Initialize with minimal config const credentialManager = new CredentialManager() await credentialManager.loadConfiguration({ accounts: [ { id: 'test-pacifica', name: 'Test Pacifica Account', platform: Platform.PACIFICA, enabled: true, credentials: { type: 'ed25519' as const, privateKey: 'f26670e2ca334117f8859f9f32e50251641953a30b54f6ffcf82db836cfdfea5' } } ] }) console.log('āœ… Credential manager initialized') // Test basic signing const message = new TextEncoder().encode('Hello, multi-platform trading!') console.log('\nšŸ” Testing signature...') const startTime = Date.now() const result = await credentialManager.sign('test-pacifica', message) const duration = Date.now() - startTime if (result.success) { console.log(`āœ… Signature successful!`) console.log(`šŸ“‹ Algorithm: ${result.algorithm}`) console.log(`⚔ Time: ${duration}ms`) console.log(`šŸ” Signature: ${result.signature?.substring(0, 32)}...`) } else { console.log(`āŒ Signature failed: ${result.error}`) } // Test trading integration console.log('\nšŸ’¹ Testing trading integration...') const tradingRequest = { operation: TradingOperation.PLACE_ORDER, platform: Platform.PACIFICA, parameters: { symbol: 'SOL/USDC', side: 'buy' as const, quantity: 1.0, type: 'market' as const } } const tradingResult = await credentialManager.signTradingRequest(tradingRequest) if (tradingResult.success) { console.log(`āœ… Trading request signed!`) console.log(`šŸ“‹ Platform: ${tradingResult.selectedAccount.platform}`) console.log(`šŸ¦ Account: ${tradingResult.selectedAccount.accountId}`) console.log(`šŸ“ Format: ${tradingResult.platformSignature.format}`) } await credentialManager.shutdown() console.log('\nšŸŽ‰ Demo completed! The credential manager is working perfectly.') console.log('\nšŸ“š Next steps:') console.log(' 1. Update config/credential-manager.example.json with your credentials') console.log(' 2. Run the full demo: npx tsx src/examples/credential-manager-demo.ts') console.log(' 3. Integrate with your trading system using the TradingIntegration interface') } quickDemo().catch(console.error)