agentvault 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +9 -0
- package/README.md +1 -1
- package/dist/cli/commands/approve.js +5 -5
- package/dist/cli/commands/archive.js +5 -5
- package/dist/cli/commands/backup.js +5 -5
- package/dist/cli/commands/cloud-backup.js +12 -12
- package/dist/cli/commands/decrypt.js +2 -2
- package/dist/cli/commands/deploy.js +1 -1
- package/dist/cli/commands/exec.js +2 -2
- package/dist/cli/commands/fetch.js +4 -4
- package/dist/cli/commands/inference.js +5 -5
- package/dist/cli/commands/init.d.ts +1 -1
- package/dist/cli/commands/init.js +16 -16
- package/dist/cli/commands/list.js +4 -4
- package/dist/cli/commands/package.js +2 -2
- package/dist/cli/commands/profile.js +1 -1
- package/dist/cli/commands/rebuild.js +2 -2
- package/dist/cli/commands/show.js +1 -1
- package/dist/cli/commands/status.d.ts +1 -1
- package/dist/cli/commands/status.js +8 -8
- package/dist/cli/commands/trace.js +1 -1
- package/dist/cli/commands/wallet-export.js +1 -1
- package/dist/cli/commands/wallet-sign.js +1 -1
- package/dist/cli/commands/wallet.d.ts +1 -1
- package/dist/cli/commands/wallet.js +1 -1
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +3 -3
- package/dist/src/archival/archive-manager.d.ts +85 -0
- package/dist/src/archival/archive-manager.js +294 -0
- package/dist/src/archival/arweave-client.d.ts +88 -0
- package/dist/src/archival/arweave-client.js +223 -0
- package/dist/src/archival/index.d.ts +8 -0
- package/{src/archival/index.ts → dist/src/archival/index.js} +1 -1
- package/dist/src/backup/backup.d.ts +67 -0
- package/dist/src/backup/backup.js +231 -0
- package/dist/src/backup/index.d.ts +7 -0
- package/{src/backup/index.ts → dist/src/backup/index.js} +1 -1
- package/dist/src/cloud-storage/cloud-sync.d.ts +49 -0
- package/dist/src/cloud-storage/cloud-sync.js +372 -0
- package/dist/src/cloud-storage/index.d.ts +11 -0
- package/{src/cloud-storage/index.ts → dist/src/cloud-storage/index.js} +1 -1
- package/dist/src/cloud-storage/provider-detector.d.ts +34 -0
- package/dist/src/cloud-storage/provider-detector.js +158 -0
- package/{src/cloud-storage/types.ts → dist/src/cloud-storage/types.d.ts} +40 -53
- package/dist/src/cloud-storage/types.js +10 -0
- package/dist/src/debugging/index.d.ts +6 -0
- package/{src/debugging/index.ts → dist/src/debugging/index.js} +1 -1
- package/dist/src/debugging/logs.d.ts +32 -0
- package/dist/src/debugging/logs.js +158 -0
- package/dist/src/debugging/types.d.ts +91 -0
- package/dist/src/debugging/types.js +5 -0
- package/dist/src/deployment/deployer.d.ts +52 -0
- package/dist/src/deployment/deployer.js +211 -0
- package/dist/src/deployment/icpClient.d.ts +144 -0
- package/dist/src/deployment/icpClient.js +545 -0
- package/dist/src/deployment/index.d.ts +11 -0
- package/dist/src/deployment/index.js +14 -0
- package/dist/src/deployment/promotion.d.ts +32 -0
- package/dist/src/deployment/promotion.js +114 -0
- package/dist/src/deployment/types.d.ts +101 -0
- package/dist/src/deployment/types.js +5 -0
- package/dist/src/icp/batch.d.ts +112 -0
- package/dist/src/icp/batch.js +273 -0
- package/dist/src/icp/cycles.d.ts +29 -0
- package/{src/icp/cycles.ts → dist/src/icp/cycles.js} +8 -22
- package/dist/src/icp/environment.d.ts +60 -0
- package/dist/src/icp/environment.js +183 -0
- package/dist/src/icp/icpcli.d.ts +204 -0
- package/dist/src/icp/icpcli.js +374 -0
- package/dist/src/icp/icwasm.d.ts +94 -0
- package/dist/src/icp/icwasm.js +197 -0
- package/dist/src/icp/identity.d.ts +50 -0
- package/{src/icp/identity.ts → dist/src/icp/identity.js} +15 -28
- package/dist/src/icp/index.d.ts +16 -0
- package/dist/src/icp/index.js +20 -0
- package/dist/src/icp/optimization.d.ts +16 -0
- package/dist/src/icp/optimization.js +225 -0
- package/dist/src/icp/tokens.d.ts +24 -0
- package/{src/icp/tokens.ts → dist/src/icp/tokens.js} +5 -12
- package/dist/src/icp/tool-detector.d.ts +31 -0
- package/dist/src/icp/tool-detector.js +104 -0
- package/dist/src/icp/types.d.ts +493 -0
- package/dist/src/icp/types.js +7 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.js +18 -0
- package/dist/src/inference/bittensor-client.d.ts +108 -0
- package/dist/src/inference/bittensor-client.js +224 -0
- package/dist/src/inference/index.d.ts +8 -0
- package/{src/inference/index.ts → dist/src/inference/index.js} +1 -1
- package/dist/src/inference/inference-manager.d.ts +76 -0
- package/dist/src/inference/inference-manager.js +228 -0
- package/dist/src/metrics/index.d.ts +7 -0
- package/{src/metrics/index.ts → dist/src/metrics/index.js} +1 -1
- package/dist/src/metrics/metrics.d.ts +39 -0
- package/dist/src/metrics/metrics.js +129 -0
- package/dist/src/monitoring/alerting.d.ts +51 -0
- package/dist/src/monitoring/alerting.js +169 -0
- package/dist/src/monitoring/health.d.ts +40 -0
- package/dist/src/monitoring/health.js +164 -0
- package/dist/src/monitoring/index.d.ts +10 -0
- package/dist/src/monitoring/index.js +12 -0
- package/dist/src/monitoring/info.d.ts +15 -0
- package/dist/src/monitoring/info.js +109 -0
- package/dist/src/monitoring/types.d.ts +93 -0
- package/dist/src/monitoring/types.js +7 -0
- package/dist/src/network/index.d.ts +5 -0
- package/{src/network/index.ts → dist/src/network/index.js} +1 -1
- package/dist/src/network/network-config.d.ts +31 -0
- package/dist/src/network/network-config.js +109 -0
- package/dist/src/packaging/compiler.d.ts +61 -0
- package/dist/src/packaging/compiler.js +562 -0
- package/dist/src/packaging/config-persistence.d.ts +46 -0
- package/dist/src/packaging/config-persistence.js +108 -0
- package/dist/src/packaging/config-schemas.d.ts +115 -0
- package/dist/src/packaging/config-schemas.js +43 -0
- package/dist/src/packaging/detector.d.ts +26 -0
- package/dist/src/packaging/detector.js +193 -0
- package/dist/src/packaging/index.d.ts +16 -0
- package/dist/src/packaging/index.js +22 -0
- package/dist/src/packaging/packager.d.ts +31 -0
- package/dist/src/packaging/packager.js +90 -0
- package/dist/src/packaging/parsers/clawdbot.d.ts +19 -0
- package/dist/src/packaging/parsers/clawdbot.js +231 -0
- package/dist/src/packaging/parsers/cline.d.ts +26 -0
- package/dist/src/packaging/parsers/cline.js +185 -0
- package/dist/src/packaging/parsers/generic.d.ts +27 -0
- package/dist/src/packaging/parsers/generic.js +228 -0
- package/dist/src/packaging/parsers/goose.d.ts +26 -0
- package/dist/src/packaging/parsers/goose.js +175 -0
- package/dist/src/packaging/parsers/index.d.ts +11 -0
- package/{src/packaging/parsers/index.ts → dist/src/packaging/parsers/index.js} +1 -1
- package/dist/src/packaging/serializer.d.ts +108 -0
- package/dist/src/packaging/serializer.js +153 -0
- package/dist/src/packaging/types.d.ts +131 -0
- package/dist/src/packaging/types.js +5 -0
- package/dist/src/packaging/wasmedge-compiler.d.ts +76 -0
- package/dist/src/packaging/wasmedge-compiler.js +349 -0
- package/dist/src/security/index.d.ts +11 -0
- package/{src/security/index.ts → dist/src/security/index.js} +1 -4
- package/dist/src/security/multisig.d.ts +102 -0
- package/dist/src/security/multisig.js +283 -0
- package/dist/src/security/types.d.ts +207 -0
- package/dist/src/security/types.js +217 -0
- package/dist/src/security/vetkeys.d.ts +179 -0
- package/dist/src/security/vetkeys.js +499 -0
- package/dist/src/testing/index.d.ts +6 -0
- package/{src/testing/index.ts → dist/src/testing/index.js} +1 -1
- package/dist/src/testing/local-runner.d.ts +23 -0
- package/dist/src/testing/local-runner.js +226 -0
- package/dist/src/testing/types.d.ts +98 -0
- package/dist/src/testing/types.js +5 -0
- package/dist/src/wallet/cbor-serializer.d.ts +82 -0
- package/dist/src/wallet/cbor-serializer.js +282 -0
- package/dist/src/wallet/chain-dispatcher.d.ts +112 -0
- package/dist/src/wallet/chain-dispatcher.js +241 -0
- package/dist/src/wallet/cross-chain-aggregator.d.ts +119 -0
- package/dist/src/wallet/cross-chain-aggregator.js +235 -0
- package/dist/src/wallet/index.d.ts +16 -0
- package/dist/src/wallet/index.js +22 -0
- package/dist/src/wallet/key-derivation.d.ts +117 -0
- package/dist/src/wallet/key-derivation.js +325 -0
- package/dist/src/wallet/providers/base-provider.d.ts +111 -0
- package/dist/src/wallet/providers/base-provider.js +58 -0
- package/dist/src/wallet/providers/cketh-provider.d.ts +104 -0
- package/dist/src/wallet/providers/cketh-provider.js +343 -0
- package/dist/src/wallet/providers/polkadot-provider.d.ts +115 -0
- package/dist/src/wallet/providers/polkadot-provider.js +407 -0
- package/dist/src/wallet/providers/solana-provider.d.ts +102 -0
- package/dist/src/wallet/providers/solana-provider.js +393 -0
- package/dist/src/wallet/transaction-queue.d.ts +133 -0
- package/dist/src/wallet/transaction-queue.js +195 -0
- package/dist/src/wallet/types.d.ts +167 -0
- package/dist/src/wallet/types.js +5 -0
- package/dist/src/wallet/vetkeys-adapter.d.ts +134 -0
- package/dist/src/wallet/vetkeys-adapter.js +313 -0
- package/dist/src/wallet/wallet-manager.d.ts +202 -0
- package/dist/src/wallet/wallet-manager.js +451 -0
- package/dist/src/wallet/wallet-storage.d.ts +131 -0
- package/dist/src/wallet/wallet-storage.js +274 -0
- package/macos-wallet-app/AgentVaultWallet/App/AgentVaultWalletApp.swift +54 -0
- package/macos-wallet-app/AgentVaultWallet/Models/AppState.swift +102 -0
- package/macos-wallet-app/AgentVaultWallet/Models/Chain.swift +121 -0
- package/macos-wallet-app/AgentVaultWallet/Models/Wallet.swift +98 -0
- package/macos-wallet-app/AgentVaultWallet/Resources/AgentVaultWallet.entitlements +27 -0
- package/macos-wallet-app/AgentVaultWallet/Resources/Info.plist +69 -0
- package/macos-wallet-app/AgentVaultWallet/Services/BackupService.swift +270 -0
- package/macos-wallet-app/AgentVaultWallet/Services/CLIBridge.swift +367 -0
- package/macos-wallet-app/AgentVaultWallet/Services/CryptoService.swift +157 -0
- package/macos-wallet-app/AgentVaultWallet/Services/FileService.swift +120 -0
- package/macos-wallet-app/AgentVaultWallet/Services/KeychainService.swift +219 -0
- package/macos-wallet-app/AgentVaultWallet/Utilities/Constants.swift +44 -0
- package/macos-wallet-app/AgentVaultWallet/Utilities/Extensions.swift +115 -0
- package/macos-wallet-app/AgentVaultWallet/ViewModels/BackupViewModel.swift +237 -0
- package/macos-wallet-app/AgentVaultWallet/ViewModels/CreateWalletViewModel.swift +137 -0
- package/macos-wallet-app/AgentVaultWallet/ViewModels/ImportWalletViewModel.swift +179 -0
- package/macos-wallet-app/AgentVaultWallet/ViewModels/WalletStore.swift +286 -0
- package/macos-wallet-app/AgentVaultWallet/Views/Backup/BackupView.swift +235 -0
- package/macos-wallet-app/AgentVaultWallet/Views/Backup/RestoreView.swift +316 -0
- package/macos-wallet-app/AgentVaultWallet/Views/Create/CreateWalletFlow.swift +438 -0
- package/macos-wallet-app/AgentVaultWallet/Views/Import/ImportWalletFlow.swift +399 -0
- package/macos-wallet-app/AgentVaultWallet/Views/MainView.swift +134 -0
- package/macos-wallet-app/AgentVaultWallet/Views/Settings/SettingsView.swift +276 -0
- package/macos-wallet-app/AgentVaultWallet/Views/Sidebar/SidebarView.swift +133 -0
- package/macos-wallet-app/AgentVaultWallet/Views/Wallet/DashboardView.swift +233 -0
- package/macos-wallet-app/AgentVaultWallet/Views/Wallet/WalletDetailView.swift +281 -0
- package/macos-wallet-app/AgentVaultWallet/Views/Wallet/WalletListView.swift +280 -0
- package/macos-wallet-app/AgentVaultWallet/Views/Welcome/WelcomeView.swift +176 -0
- package/macos-wallet-app/Makefile +47 -0
- package/macos-wallet-app/project.yml +40 -0
- package/macos-wallet-app/setup.sh +73 -0
- package/package.json +10 -2
- package/backups/agentvault-backup-test-agent-2026-02-12T17-54-28-967Z.json +0 -28
- package/backups/agentvault-backup-test-agent-2026-02-12T17-54-29-032Z.backup +0 -1
- package/backups/agentvault-backup-test-agent-2026-02-12T17-57-42-373Z.json +0 -28
- package/backups/agentvault-backup-test-agent-2026-02-12T17-57-42-428Z.backup +0 -1
- package/backups/agentvault-backup-test-agent-2026-02-12T18-52-25-132Z.json +0 -28
- package/backups/agentvault-backup-test-agent-2026-02-12T18-52-25-247Z.backup +0 -1
- package/backups/agentvault-backup-test-agent-2026-02-12T18-54-09-216Z.json +0 -28
- package/backups/agentvault-backup-test-agent-2026-02-12T18-54-09-283Z.backup +0 -1
- package/backups/agentvault-backup-test-agent-2026-02-12T22-18-22-772Z.backup +0 -1
- package/backups/agentvault-backup-test-agent-2026-02-12T22-18-22-793Z.json +0 -28
- package/backups/test-backup.json +0 -28
- package/scripts/dev-dashboard.mjs +0 -84
- package/site/README.md +0 -63
- package/site/docusaurus.config.ts +0 -148
- package/site/package-lock.json +0 -18383
- package/site/package.json +0 -47
- package/site/sidebars.ts +0 -86
- package/site/static/.gitkeep +0 -0
- package/site/static/img/logo.svg +0 -28
- package/site/static/img/og-image.svg +0 -35
- package/src/archival/archive-manager.ts +0 -372
- package/src/archival/arweave-client.ts +0 -289
- package/src/backup/backup.ts +0 -315
- package/src/cloud-storage/cloud-sync.ts +0 -461
- package/src/cloud-storage/provider-detector.ts +0 -198
- package/src/debugging/logs.ts +0 -193
- package/src/debugging/types.ts +0 -100
- package/src/deployment/deployer.ts +0 -274
- package/src/deployment/icpClient.ts +0 -620
- package/src/deployment/index.ts +0 -46
- package/src/deployment/promotion.ts +0 -161
- package/src/deployment/types.ts +0 -111
- package/src/icp/batch.ts +0 -374
- package/src/icp/environment.ts +0 -215
- package/src/icp/icpcli.ts +0 -438
- package/src/icp/icwasm.ts +0 -222
- package/src/icp/index.ts +0 -94
- package/src/icp/optimization.ts +0 -242
- package/src/icp/tool-detector.ts +0 -110
- package/src/icp/types.ts +0 -574
- package/src/index.ts +0 -25
- package/src/inference/bittensor-client.ts +0 -304
- package/src/inference/inference-manager.ts +0 -327
- package/src/metrics/metrics.ts +0 -186
- package/src/monitoring/alerting.ts +0 -190
- package/src/monitoring/health.ts +0 -197
- package/src/monitoring/index.ts +0 -38
- package/src/monitoring/info.ts +0 -114
- package/src/monitoring/types.ts +0 -99
- package/src/network/network-config.ts +0 -129
- package/src/packaging/compiler.ts +0 -647
- package/src/packaging/config-persistence.ts +0 -135
- package/src/packaging/config-schemas.ts +0 -156
- package/src/packaging/detector.ts +0 -220
- package/src/packaging/index.ts +0 -90
- package/src/packaging/packager.ts +0 -118
- package/src/packaging/parsers/clawdbot.ts +0 -278
- package/src/packaging/parsers/cline.ts +0 -223
- package/src/packaging/parsers/generic.ts +0 -266
- package/src/packaging/parsers/goose.ts +0 -214
- package/src/packaging/serializer.ts +0 -260
- package/src/packaging/types.ts +0 -144
- package/src/packaging/wasmedge-compiler.ts +0 -406
- package/src/security/multisig.ts +0 -415
- package/src/security/types.ts +0 -416
- package/src/security/vetkeys.ts +0 -655
- package/src/testing/local-runner.ts +0 -264
- package/src/testing/types.ts +0 -104
- package/src/wallet/cbor-serializer.ts +0 -323
- package/src/wallet/chain-dispatcher.ts +0 -313
- package/src/wallet/cross-chain-aggregator.ts +0 -346
- package/src/wallet/index.ts +0 -76
- package/src/wallet/key-derivation.ts +0 -425
- package/src/wallet/providers/base-provider.ts +0 -154
- package/src/wallet/providers/cketh-provider.ts +0 -434
- package/src/wallet/providers/polkadot-provider.ts +0 -503
- package/src/wallet/providers/solana-provider.ts +0 -490
- package/src/wallet/transaction-queue.ts +0 -284
- package/src/wallet/types.ts +0 -178
- package/src/wallet/vetkeys-adapter.ts +0 -431
- package/src/wallet/wallet-manager.ts +0 -597
- package/src/wallet/wallet-storage.ts +0 -380
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-Chain Aggregator (Phase 5C)
|
|
3
|
+
*
|
|
4
|
+
* Executes multiple blockchain transactions in parallel.
|
|
5
|
+
* Supports independent execution (no atomic rollback) as per user preference.
|
|
6
|
+
*/
|
|
7
|
+
import type { WalletData, TransactionRequest, Transaction, ChainType } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Multi-chain action
|
|
10
|
+
*/
|
|
11
|
+
export interface MultiChainAction {
|
|
12
|
+
walletId: string;
|
|
13
|
+
chain: ChainType;
|
|
14
|
+
request: TransactionRequest;
|
|
15
|
+
priority?: 'low' | 'normal' | 'high';
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Cross-chain execution result
|
|
19
|
+
*/
|
|
20
|
+
export interface CrossChainResult {
|
|
21
|
+
action: MultiChainAction;
|
|
22
|
+
success: boolean;
|
|
23
|
+
txHash?: string;
|
|
24
|
+
error?: string;
|
|
25
|
+
executedAt: number;
|
|
26
|
+
duration?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Aggregated execution results
|
|
30
|
+
*/
|
|
31
|
+
export interface AggregatedResults {
|
|
32
|
+
total: number;
|
|
33
|
+
succeeded: number;
|
|
34
|
+
failed: number;
|
|
35
|
+
results: CrossChainResult[];
|
|
36
|
+
duration: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Cross-chain aggregator options
|
|
40
|
+
*/
|
|
41
|
+
export interface AggregatorOptions {
|
|
42
|
+
maxConcurrency?: number;
|
|
43
|
+
timeout?: number;
|
|
44
|
+
continueOnError?: boolean;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Cross-chain aggregator
|
|
48
|
+
*
|
|
49
|
+
* Executes transactions across multiple blockchains in parallel.
|
|
50
|
+
* Independent execution: No rollback on partial failure.
|
|
51
|
+
*/
|
|
52
|
+
export declare class CrossChainAggregator {
|
|
53
|
+
private dispatcher;
|
|
54
|
+
private options;
|
|
55
|
+
constructor(options?: AggregatorOptions);
|
|
56
|
+
/**
|
|
57
|
+
* Execute multiple cross-chain actions
|
|
58
|
+
*
|
|
59
|
+
* @param actions - Array of multi-chain actions
|
|
60
|
+
* @returns Aggregated results
|
|
61
|
+
*/
|
|
62
|
+
execute(actions: MultiChainAction[]): Promise<AggregatedResults>;
|
|
63
|
+
/**
|
|
64
|
+
* Execute actions in parallel with concurrency limit
|
|
65
|
+
*/
|
|
66
|
+
private executeParallel;
|
|
67
|
+
/**
|
|
68
|
+
* Execute a single cross-chain action
|
|
69
|
+
*/
|
|
70
|
+
private executeAction;
|
|
71
|
+
/**
|
|
72
|
+
* Split array into chunks
|
|
73
|
+
*/
|
|
74
|
+
private chunkArray;
|
|
75
|
+
/**
|
|
76
|
+
* Get balances across multiple chains
|
|
77
|
+
*
|
|
78
|
+
* @param wallets - Array of wallets to query
|
|
79
|
+
* @returns Array of balances
|
|
80
|
+
*/
|
|
81
|
+
getBalances(wallets: WalletData[]): Promise<Array<{
|
|
82
|
+
wallet: WalletData;
|
|
83
|
+
amount: string;
|
|
84
|
+
denomination: string;
|
|
85
|
+
}>>;
|
|
86
|
+
/**
|
|
87
|
+
* Get transaction history across multiple chains
|
|
88
|
+
*
|
|
89
|
+
* @param wallets - Array of wallets to query
|
|
90
|
+
* @param limit - Maximum transactions per wallet
|
|
91
|
+
* @returns Array of transactions
|
|
92
|
+
*/
|
|
93
|
+
getMultiChainHistory(wallets: WalletData[], limit?: number): Promise<Transaction[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Estimate fees across multiple chains
|
|
96
|
+
*
|
|
97
|
+
* @param actions - Array of actions to estimate
|
|
98
|
+
* @returns Array of fee estimates
|
|
99
|
+
*/
|
|
100
|
+
estimateFees(actions: MultiChainAction[]): Promise<Array<{
|
|
101
|
+
action: MultiChainAction;
|
|
102
|
+
fee: string;
|
|
103
|
+
}>>;
|
|
104
|
+
/**
|
|
105
|
+
* Create cross-chain batch summary
|
|
106
|
+
*
|
|
107
|
+
* @param results - Aggregated execution results
|
|
108
|
+
* @returns Formatted summary
|
|
109
|
+
*/
|
|
110
|
+
createSummary(results: AggregatedResults): string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Create cross-chain aggregator
|
|
114
|
+
*
|
|
115
|
+
* @param options - Aggregator options
|
|
116
|
+
* @returns Cross-chain aggregator instance
|
|
117
|
+
*/
|
|
118
|
+
export declare function createCrossChainAggregator(options?: AggregatorOptions): CrossChainAggregator;
|
|
119
|
+
//# sourceMappingURL=cross-chain-aggregator.d.ts.map
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-Chain Aggregator (Phase 5C)
|
|
3
|
+
*
|
|
4
|
+
* Executes multiple blockchain transactions in parallel.
|
|
5
|
+
* Supports independent execution (no atomic rollback) as per user preference.
|
|
6
|
+
*/
|
|
7
|
+
import { ChainDispatcher } from './chain-dispatcher.js';
|
|
8
|
+
/**
|
|
9
|
+
* Cross-chain aggregator
|
|
10
|
+
*
|
|
11
|
+
* Executes transactions across multiple blockchains in parallel.
|
|
12
|
+
* Independent execution: No rollback on partial failure.
|
|
13
|
+
*/
|
|
14
|
+
export class CrossChainAggregator {
|
|
15
|
+
dispatcher;
|
|
16
|
+
options;
|
|
17
|
+
constructor(options) {
|
|
18
|
+
this.dispatcher = new ChainDispatcher();
|
|
19
|
+
this.options = {
|
|
20
|
+
maxConcurrency: options?.maxConcurrency ?? 5,
|
|
21
|
+
timeout: options?.timeout ?? 30000,
|
|
22
|
+
continueOnError: options?.continueOnError ?? true,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Execute multiple cross-chain actions
|
|
27
|
+
*
|
|
28
|
+
* @param actions - Array of multi-chain actions
|
|
29
|
+
* @returns Aggregated results
|
|
30
|
+
*/
|
|
31
|
+
async execute(actions) {
|
|
32
|
+
const startTime = Date.now();
|
|
33
|
+
if (actions.length === 0) {
|
|
34
|
+
return {
|
|
35
|
+
total: 0,
|
|
36
|
+
succeeded: 0,
|
|
37
|
+
failed: 0,
|
|
38
|
+
results: [],
|
|
39
|
+
duration: 0,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
console.log(`Executing ${actions.length} cross-chain actions...`);
|
|
43
|
+
const results = await this.executeParallel(actions);
|
|
44
|
+
const succeeded = results.filter((r) => r.success).length;
|
|
45
|
+
const failed = results.filter((r) => !r.success).length;
|
|
46
|
+
const duration = Date.now() - startTime;
|
|
47
|
+
console.log(`Execution complete: ${succeeded} succeeded, ${failed} failed (${duration}ms)`);
|
|
48
|
+
return {
|
|
49
|
+
total: results.length,
|
|
50
|
+
succeeded,
|
|
51
|
+
failed,
|
|
52
|
+
results,
|
|
53
|
+
duration,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Execute actions in parallel with concurrency limit
|
|
58
|
+
*/
|
|
59
|
+
async executeParallel(actions) {
|
|
60
|
+
const results = [];
|
|
61
|
+
const chunks = this.chunkArray(actions, this.options.maxConcurrency ?? 5);
|
|
62
|
+
for (const chunk of chunks) {
|
|
63
|
+
const chunkResults = await Promise.all(chunk.map((action) => this.executeAction(action)));
|
|
64
|
+
results.push(...chunkResults);
|
|
65
|
+
if (!this.options.continueOnError) {
|
|
66
|
+
const hasFailure = chunkResults.some((r) => !r.success);
|
|
67
|
+
if (hasFailure) {
|
|
68
|
+
console.log('Stopping due to failure (continueOnError = false)');
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return results;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Execute a single cross-chain action
|
|
77
|
+
*/
|
|
78
|
+
async executeAction(action) {
|
|
79
|
+
const startTime = Date.now();
|
|
80
|
+
try {
|
|
81
|
+
const { getWallet } = await import('./wallet-manager.js');
|
|
82
|
+
const wallet = getWallet('', action.walletId);
|
|
83
|
+
if (!wallet) {
|
|
84
|
+
throw new Error(`Wallet not found: ${action.walletId}`);
|
|
85
|
+
}
|
|
86
|
+
const tx = await this.dispatcher.dispatchTransaction(wallet, action.request);
|
|
87
|
+
const duration = Date.now() - startTime;
|
|
88
|
+
return {
|
|
89
|
+
action,
|
|
90
|
+
success: true,
|
|
91
|
+
txHash: tx.hash,
|
|
92
|
+
executedAt: Date.now(),
|
|
93
|
+
duration,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
const duration = Date.now() - startTime;
|
|
98
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
99
|
+
return {
|
|
100
|
+
action,
|
|
101
|
+
success: false,
|
|
102
|
+
error: message,
|
|
103
|
+
executedAt: Date.now(),
|
|
104
|
+
duration,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Split array into chunks
|
|
110
|
+
*/
|
|
111
|
+
chunkArray(array, size) {
|
|
112
|
+
const chunks = [];
|
|
113
|
+
for (let i = 0; i < array.length; i += size) {
|
|
114
|
+
chunks.push(array.slice(i, i + size));
|
|
115
|
+
}
|
|
116
|
+
return chunks;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get balances across multiple chains
|
|
120
|
+
*
|
|
121
|
+
* @param wallets - Array of wallets to query
|
|
122
|
+
* @returns Array of balances
|
|
123
|
+
*/
|
|
124
|
+
async getBalances(wallets) {
|
|
125
|
+
const results = await Promise.all(wallets.map(async (wallet) => {
|
|
126
|
+
try {
|
|
127
|
+
const balance = await this.dispatcher.getBalance(wallet);
|
|
128
|
+
return {
|
|
129
|
+
wallet,
|
|
130
|
+
amount: balance.amount,
|
|
131
|
+
denomination: balance.denomination,
|
|
132
|
+
success: true,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
return {
|
|
137
|
+
wallet,
|
|
138
|
+
amount: '0',
|
|
139
|
+
denomination: 'N/A',
|
|
140
|
+
success: false,
|
|
141
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}));
|
|
145
|
+
return results;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get transaction history across multiple chains
|
|
149
|
+
*
|
|
150
|
+
* @param wallets - Array of wallets to query
|
|
151
|
+
* @param limit - Maximum transactions per wallet
|
|
152
|
+
* @returns Array of transactions
|
|
153
|
+
*/
|
|
154
|
+
async getMultiChainHistory(wallets, limit = 20) {
|
|
155
|
+
const results = await Promise.all(wallets.map(async (wallet) => {
|
|
156
|
+
try {
|
|
157
|
+
return await this.dispatcher.getTransactionHistory(wallet, limit);
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
console.error(`Failed to get history for ${wallet.id}:`, error);
|
|
161
|
+
return [];
|
|
162
|
+
}
|
|
163
|
+
}));
|
|
164
|
+
return results.flat().slice(0, wallets.length * limit);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Estimate fees across multiple chains
|
|
168
|
+
*
|
|
169
|
+
* @param actions - Array of actions to estimate
|
|
170
|
+
* @returns Array of fee estimates
|
|
171
|
+
*/
|
|
172
|
+
async estimateFees(actions) {
|
|
173
|
+
const results = await Promise.all(actions.map(async (action) => {
|
|
174
|
+
try {
|
|
175
|
+
const { getWallet } = await import('./wallet-manager.js');
|
|
176
|
+
const wallet = getWallet('', action.walletId);
|
|
177
|
+
if (!wallet) {
|
|
178
|
+
throw new Error(`Wallet not found: ${action.walletId}`);
|
|
179
|
+
}
|
|
180
|
+
const fee = await this.dispatcher.estimateFee(wallet, action.request);
|
|
181
|
+
return {
|
|
182
|
+
action,
|
|
183
|
+
fee,
|
|
184
|
+
success: true,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
return {
|
|
189
|
+
action,
|
|
190
|
+
fee: 'N/A',
|
|
191
|
+
success: false,
|
|
192
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}));
|
|
196
|
+
return results;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Create cross-chain batch summary
|
|
200
|
+
*
|
|
201
|
+
* @param results - Aggregated execution results
|
|
202
|
+
* @returns Formatted summary
|
|
203
|
+
*/
|
|
204
|
+
createSummary(results) {
|
|
205
|
+
const lines = [];
|
|
206
|
+
lines.push('Cross-Chain Execution Summary');
|
|
207
|
+
lines.push('============================');
|
|
208
|
+
lines.push(`Total Actions: ${results.total}`);
|
|
209
|
+
lines.push(`Succeeded: ${results.succeeded}`);
|
|
210
|
+
lines.push(`Failed: ${results.failed}`);
|
|
211
|
+
lines.push(`Success Rate: ${results.total > 0 ? ((results.succeeded / results.total) * 100).toFixed(2) : 0}%`);
|
|
212
|
+
lines.push(`Total Duration: ${results.duration}ms`);
|
|
213
|
+
if (results.failed > 0) {
|
|
214
|
+
lines.push('');
|
|
215
|
+
lines.push('Failed Actions:');
|
|
216
|
+
results.results
|
|
217
|
+
.filter((r) => !r.success)
|
|
218
|
+
.forEach((r) => {
|
|
219
|
+
lines.push(` [${r.action.chain}] ${r.action.walletId}`);
|
|
220
|
+
lines.push(` Error: ${r.error}`);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return lines.join('\n');
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Create cross-chain aggregator
|
|
228
|
+
*
|
|
229
|
+
* @param options - Aggregator options
|
|
230
|
+
* @returns Cross-chain aggregator instance
|
|
231
|
+
*/
|
|
232
|
+
export function createCrossChainAggregator(options) {
|
|
233
|
+
return new CrossChainAggregator(options);
|
|
234
|
+
}
|
|
235
|
+
//# sourceMappingURL=cross-chain-aggregator.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet Module
|
|
3
|
+
*
|
|
4
|
+
* Complete wallet management system for ckETH, Polkadot, and Solana.
|
|
5
|
+
* Provides per-agent wallet isolation, encryption, and CBOR serialization.
|
|
6
|
+
*/
|
|
7
|
+
export * from './types.js';
|
|
8
|
+
export { serializeWallet, deserializeWallet, serializeTransaction, deserializeTransaction, serializeTransactionRequest, deserializeTransactionRequest, serializeSignedTransaction, deserializeSignedTransaction, validateCborData, } from './cbor-serializer.js';
|
|
9
|
+
export { getWalletBaseDir, getAgentWalletDir, getWalletFilePath, ensureWalletDirectories, saveWallet, loadWallet, deleteWallet, listWallets, listAgents, walletExists, getWalletStats, backupWallets, restoreWallets, clearWallets, getWalletStorageSize, } from './wallet-storage.js';
|
|
10
|
+
export { parseDerivationPath, buildDerivationPath, validateSeedPhrase, generateSeedFromMnemonic, generateMnemonic, getDefaultDerivationPath, deriveWalletKey, } from './key-derivation.js';
|
|
11
|
+
export { createWallet, importWalletFromPrivateKey, importWalletFromSeed, importWalletFromMnemonic, generateWallet, getWallet, listAgentWallets, hasWallet, removeWallet, clearAgentWallets, cacheWalletConnection, getCachedConnection, clearCachedConnection, validateSeedPhraseWrapper, } from './wallet-manager.js';
|
|
12
|
+
export { BaseWalletProvider } from './providers/base-provider.js';
|
|
13
|
+
export { CkEthProvider } from './providers/cketh-provider.js';
|
|
14
|
+
export { PolkadotProvider } from './providers/polkadot-provider.js';
|
|
15
|
+
export { SolanaProvider } from './providers/solana-provider.js';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet Module
|
|
3
|
+
*
|
|
4
|
+
* Complete wallet management system for ckETH, Polkadot, and Solana.
|
|
5
|
+
* Provides per-agent wallet isolation, encryption, and CBOR serialization.
|
|
6
|
+
*/
|
|
7
|
+
// Types
|
|
8
|
+
export * from './types.js';
|
|
9
|
+
// CBOR Serialization
|
|
10
|
+
export { serializeWallet, deserializeWallet, serializeTransaction, deserializeTransaction, serializeTransactionRequest, deserializeTransactionRequest, serializeSignedTransaction, deserializeSignedTransaction, validateCborData, } from './cbor-serializer.js';
|
|
11
|
+
// Wallet Storage
|
|
12
|
+
export { getWalletBaseDir, getAgentWalletDir, getWalletFilePath, ensureWalletDirectories, saveWallet, loadWallet, deleteWallet, listWallets, listAgents, walletExists, getWalletStats, backupWallets, restoreWallets, clearWallets, getWalletStorageSize, } from './wallet-storage.js';
|
|
13
|
+
// Key Derivation
|
|
14
|
+
export { parseDerivationPath, buildDerivationPath, validateSeedPhrase, generateSeedFromMnemonic, generateMnemonic, getDefaultDerivationPath, deriveWalletKey, } from './key-derivation.js';
|
|
15
|
+
// Wallet Manager
|
|
16
|
+
export { createWallet, importWalletFromPrivateKey, importWalletFromSeed, importWalletFromMnemonic, generateWallet, getWallet, listAgentWallets, hasWallet, removeWallet, clearAgentWallets, cacheWalletConnection, getCachedConnection, clearCachedConnection, validateSeedPhraseWrapper, } from './wallet-manager.js';
|
|
17
|
+
// Providers
|
|
18
|
+
export { BaseWalletProvider } from './providers/base-provider.js';
|
|
19
|
+
export { CkEthProvider } from './providers/cketh-provider.js';
|
|
20
|
+
export { PolkadotProvider } from './providers/polkadot-provider.js';
|
|
21
|
+
export { SolanaProvider } from './providers/solana-provider.js';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Key Derivation Module
|
|
3
|
+
*
|
|
4
|
+
* Implements BIP39 seed phrase derivation for wallet keys.
|
|
5
|
+
* Supports multiple derivation paths for different blockchains.
|
|
6
|
+
*/
|
|
7
|
+
import type { WalletCreationMethod } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Derivation path components
|
|
10
|
+
*/
|
|
11
|
+
export interface DerivationPathComponents {
|
|
12
|
+
/** Purpose (e.g., 44' for BIP44) */
|
|
13
|
+
purpose: number;
|
|
14
|
+
/** Coin type (e.g., 60' for ETH, 0' for BTC) */
|
|
15
|
+
coinType: number;
|
|
16
|
+
/** Account index */
|
|
17
|
+
account: number;
|
|
18
|
+
/** Change index (0 for external, 1 for internal) */
|
|
19
|
+
change: number;
|
|
20
|
+
/** Address index */
|
|
21
|
+
index: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Derived key information
|
|
25
|
+
*/
|
|
26
|
+
export interface DerivedKey {
|
|
27
|
+
/** Private key (hex) */
|
|
28
|
+
privateKey: string;
|
|
29
|
+
/** Public key (hex) */
|
|
30
|
+
publicKey: string;
|
|
31
|
+
/** Address (chain-specific format) */
|
|
32
|
+
address: string;
|
|
33
|
+
/** Derivation path used */
|
|
34
|
+
derivationPath: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Parse derivation path string
|
|
38
|
+
*
|
|
39
|
+
* @param path - Derivation path string (e.g., "m/44'/60'/0'/0/0")
|
|
40
|
+
* @returns Parsed path components
|
|
41
|
+
*/
|
|
42
|
+
export declare function parseDerivationPath(path: string): DerivationPathComponents;
|
|
43
|
+
/**
|
|
44
|
+
* Build derivation path from components
|
|
45
|
+
*
|
|
46
|
+
* @param components - Path components
|
|
47
|
+
* @returns Derivation path string
|
|
48
|
+
*/
|
|
49
|
+
export declare function buildDerivationPath(components: DerivationPathComponents): string;
|
|
50
|
+
/**
|
|
51
|
+
* Validate seed phrase (BIP39)
|
|
52
|
+
*
|
|
53
|
+
* @param seedPhrase - Seed phrase to validate
|
|
54
|
+
* @returns True if valid BIP39 phrase
|
|
55
|
+
*/
|
|
56
|
+
export declare function validateSeedPhrase(seedPhrase: string): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Generate seed from seed phrase
|
|
59
|
+
*
|
|
60
|
+
* @param seedPhrase - BIP39 seed phrase
|
|
61
|
+
* @param passphrase - Optional passphrase (default empty)
|
|
62
|
+
* @returns Seed bytes
|
|
63
|
+
*/
|
|
64
|
+
export declare function generateSeedFromMnemonic(seedPhrase: string, passphrase?: string): Buffer;
|
|
65
|
+
/**
|
|
66
|
+
* Generate mnemonic from entropy
|
|
67
|
+
*
|
|
68
|
+
* @param strength - Entropy strength in bits (128, 160, 192, 224, 256)
|
|
69
|
+
* @param rng - Optional RNG function
|
|
70
|
+
* @returns BIP39 mnemonic phrase
|
|
71
|
+
*/
|
|
72
|
+
export declare function generateMnemonic(strength?: number, rng?: (size: number) => Buffer): string;
|
|
73
|
+
/**
|
|
74
|
+
* Derive Ethereum-compatible key
|
|
75
|
+
*
|
|
76
|
+
* @param seed - Seed bytes
|
|
77
|
+
* @param derivationPath - Derivation path (default: "m/44'/60'/0'/0/0")
|
|
78
|
+
* @returns Derived key with ETH address
|
|
79
|
+
*/
|
|
80
|
+
export declare function deriveEthKey(seed: Buffer, derivationPath?: string): DerivedKey;
|
|
81
|
+
/**
|
|
82
|
+
* Derive Polkadot-compatible key
|
|
83
|
+
*
|
|
84
|
+
* Uses SR25519 for key derivation and SS58 for address encoding.
|
|
85
|
+
*
|
|
86
|
+
* @param seed - Seed bytes
|
|
87
|
+
* @param derivationPath - Derivation path (default: "//hard//stash")
|
|
88
|
+
* @returns Derived key with Polkadot address
|
|
89
|
+
*/
|
|
90
|
+
export declare function derivePolkadotKey(seed: Buffer, derivationPath?: string): DerivedKey;
|
|
91
|
+
/**
|
|
92
|
+
* Derive Solana-compatible key
|
|
93
|
+
*
|
|
94
|
+
* @param seed - Seed bytes
|
|
95
|
+
* @param derivationPath - Derivation path (default: "m/44'/501'/0'/0'/0'")
|
|
96
|
+
* @returns Derived key with Solana address
|
|
97
|
+
*/
|
|
98
|
+
export declare function deriveSolanaKey(seed: Buffer, derivationPath?: string): DerivedKey;
|
|
99
|
+
/**
|
|
100
|
+
* Get default derivation path for chain
|
|
101
|
+
*
|
|
102
|
+
* @param chain - Blockchain type
|
|
103
|
+
* @returns Default derivation path
|
|
104
|
+
*/
|
|
105
|
+
export declare function getDefaultDerivationPath(chain: string): string;
|
|
106
|
+
/**
|
|
107
|
+
* Derive wallet key based on creation method
|
|
108
|
+
*
|
|
109
|
+
* @param method - Wallet creation method
|
|
110
|
+
* @param seedPhrase - Seed phrase (for 'seed' and 'mnemonic' methods)
|
|
111
|
+
* @param privateKey - Private key (for 'private-key' method)
|
|
112
|
+
* @param derivationPath - Custom derivation path
|
|
113
|
+
* @param chain - Blockchain type
|
|
114
|
+
* @returns Derived key information
|
|
115
|
+
*/
|
|
116
|
+
export declare function deriveWalletKey(method: WalletCreationMethod, seedPhrase?: string, privateKey?: string, derivationPath?: string, chain?: string): DerivedKey;
|
|
117
|
+
//# sourceMappingURL=key-derivation.d.ts.map
|