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,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CBOR Serializer/Deserializer
|
|
3
|
+
*
|
|
4
|
+
* Uses cbor-x to encode/decode wallet data and transactions.
|
|
5
|
+
* Provides efficient binary serialization for wallet operations.
|
|
6
|
+
*/
|
|
7
|
+
import * as cbor from 'cbor-x';
|
|
8
|
+
/**
|
|
9
|
+
* Serialize wallet data to CBOR
|
|
10
|
+
*
|
|
11
|
+
* @param wallet - Wallet data to serialize
|
|
12
|
+
* @param options - CBOR encoding options
|
|
13
|
+
* @returns CBOR-encoded wallet data
|
|
14
|
+
*/
|
|
15
|
+
export function serializeWallet(wallet, _options = {}) {
|
|
16
|
+
try {
|
|
17
|
+
const walletObject = {
|
|
18
|
+
id: wallet.id,
|
|
19
|
+
agentId: wallet.agentId,
|
|
20
|
+
chain: wallet.chain,
|
|
21
|
+
address: wallet.address,
|
|
22
|
+
privateKey: wallet.privateKey,
|
|
23
|
+
mnemonic: wallet.mnemonic,
|
|
24
|
+
seedDerivationPath: wallet.seedDerivationPath,
|
|
25
|
+
createdAt: wallet.createdAt,
|
|
26
|
+
updatedAt: wallet.updatedAt,
|
|
27
|
+
creationMethod: wallet.creationMethod,
|
|
28
|
+
chainMetadata: wallet.chainMetadata,
|
|
29
|
+
};
|
|
30
|
+
const encoded = cbor.encode(walletObject);
|
|
31
|
+
// Add checksum for tamper detection
|
|
32
|
+
const checksum = calculateChecksum(encoded);
|
|
33
|
+
const withChecksum = new Uint8Array(encoded.length + checksum.length);
|
|
34
|
+
withChecksum.set(encoded);
|
|
35
|
+
withChecksum.set(checksum, encoded.length);
|
|
36
|
+
return withChecksum;
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
40
|
+
throw new Error(`Failed to serialize wallet: ${message}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Deserialize CBOR data to wallet
|
|
45
|
+
*
|
|
46
|
+
* @param data - CBOR-encoded wallet data
|
|
47
|
+
* @returns Deserialized wallet data
|
|
48
|
+
*/
|
|
49
|
+
export function deserializeWallet(data) {
|
|
50
|
+
try {
|
|
51
|
+
// Verify checksum
|
|
52
|
+
const checksumLength = 4;
|
|
53
|
+
if (data.length < checksumLength) {
|
|
54
|
+
throw new Error('Invalid wallet data: too short');
|
|
55
|
+
}
|
|
56
|
+
const payload = data.slice(0, -checksumLength);
|
|
57
|
+
const checksum = data.slice(-checksumLength);
|
|
58
|
+
const expectedChecksum = calculateChecksum(payload);
|
|
59
|
+
if (!buffersEqual(checksum, expectedChecksum)) {
|
|
60
|
+
throw new Error('Invalid wallet data: checksum mismatch');
|
|
61
|
+
}
|
|
62
|
+
const decoded = cbor.decode(payload);
|
|
63
|
+
if (!decoded) {
|
|
64
|
+
throw new Error('Invalid wallet data: decode failed');
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
id: decoded.id || '',
|
|
68
|
+
agentId: decoded.agentId || '',
|
|
69
|
+
chain: decoded.chain || 'cketh',
|
|
70
|
+
address: decoded.address || '',
|
|
71
|
+
privateKey: decoded.privateKey,
|
|
72
|
+
mnemonic: decoded.mnemonic,
|
|
73
|
+
seedDerivationPath: decoded.seedDerivationPath,
|
|
74
|
+
createdAt: decoded.createdAt || Date.now(),
|
|
75
|
+
updatedAt: decoded.updatedAt || Date.now(),
|
|
76
|
+
creationMethod: decoded.creationMethod || 'seed',
|
|
77
|
+
chainMetadata: decoded.chainMetadata,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
82
|
+
throw new Error(`Failed to deserialize wallet: ${message}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Serialize transaction to CBOR
|
|
87
|
+
*
|
|
88
|
+
* @param transaction - Transaction to serialize
|
|
89
|
+
* @returns CBOR-encoded transaction
|
|
90
|
+
*/
|
|
91
|
+
export function serializeTransaction(transaction) {
|
|
92
|
+
try {
|
|
93
|
+
const txObject = {
|
|
94
|
+
hash: transaction.hash,
|
|
95
|
+
from: transaction.from,
|
|
96
|
+
to: transaction.to,
|
|
97
|
+
amount: transaction.amount,
|
|
98
|
+
chain: transaction.chain,
|
|
99
|
+
timestamp: transaction.timestamp,
|
|
100
|
+
status: transaction.status,
|
|
101
|
+
fee: transaction.fee,
|
|
102
|
+
data: transaction.data,
|
|
103
|
+
};
|
|
104
|
+
return cbor.encode(txObject);
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
108
|
+
throw new Error(`Failed to serialize transaction: ${message}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Deserialize CBOR data to transaction
|
|
113
|
+
*
|
|
114
|
+
* @param data - CBOR-encoded transaction data
|
|
115
|
+
* @returns Deserialized transaction
|
|
116
|
+
*/
|
|
117
|
+
export function deserializeTransaction(data) {
|
|
118
|
+
try {
|
|
119
|
+
const decoded = cbor.decode(data);
|
|
120
|
+
return {
|
|
121
|
+
hash: decoded.hash || '',
|
|
122
|
+
from: decoded.from || '',
|
|
123
|
+
to: decoded.to || '',
|
|
124
|
+
amount: decoded.amount || '0',
|
|
125
|
+
chain: decoded.chain || 'cketh',
|
|
126
|
+
timestamp: decoded.timestamp || Date.now(),
|
|
127
|
+
status: decoded.status || 'pending',
|
|
128
|
+
fee: decoded.fee,
|
|
129
|
+
data: decoded.data,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
134
|
+
throw new Error(`Failed to deserialize transaction: ${message}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Serialize transaction request to CBOR
|
|
139
|
+
*
|
|
140
|
+
* @param request - Transaction request to serialize
|
|
141
|
+
* @returns CBOR-encoded transaction request
|
|
142
|
+
*/
|
|
143
|
+
export function serializeTransactionRequest(request) {
|
|
144
|
+
try {
|
|
145
|
+
const requestObject = {
|
|
146
|
+
to: request.to,
|
|
147
|
+
amount: request.amount,
|
|
148
|
+
chain: request.chain,
|
|
149
|
+
memo: request.memo,
|
|
150
|
+
gasPrice: request.gasPrice,
|
|
151
|
+
gasLimit: request.gasLimit,
|
|
152
|
+
};
|
|
153
|
+
return cbor.encode(requestObject);
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
157
|
+
throw new Error(`Failed to serialize transaction request: ${message}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Deserialize CBOR data to transaction request
|
|
162
|
+
*
|
|
163
|
+
* @param data - CBOR-encoded transaction request data
|
|
164
|
+
* @returns Deserialized transaction request
|
|
165
|
+
*/
|
|
166
|
+
export function deserializeTransactionRequest(data) {
|
|
167
|
+
try {
|
|
168
|
+
const decoded = cbor.decode(data);
|
|
169
|
+
return {
|
|
170
|
+
to: decoded.to || '',
|
|
171
|
+
amount: decoded.amount || '0',
|
|
172
|
+
chain: decoded.chain || 'cketh',
|
|
173
|
+
memo: decoded.memo,
|
|
174
|
+
gasPrice: decoded.gasPrice,
|
|
175
|
+
gasLimit: decoded.gasLimit,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
180
|
+
throw new Error(`Failed to deserialize transaction request: ${message}`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Serialize signed transaction to CBOR
|
|
185
|
+
*
|
|
186
|
+
* @param signedTx - Signed transaction to serialize
|
|
187
|
+
* @returns CBOR-encoded signed transaction
|
|
188
|
+
*/
|
|
189
|
+
export function serializeSignedTransaction(signedTx) {
|
|
190
|
+
try {
|
|
191
|
+
const txObject = {
|
|
192
|
+
txHash: signedTx.txHash,
|
|
193
|
+
signedTx: signedTx.signedTx,
|
|
194
|
+
signature: signedTx.signature,
|
|
195
|
+
request: signedTx.request,
|
|
196
|
+
};
|
|
197
|
+
return cbor.encode(txObject);
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
201
|
+
throw new Error(`Failed to serialize signed transaction: ${message}`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Deserialize CBOR data to signed transaction
|
|
206
|
+
*
|
|
207
|
+
* @param data - CBOR-encoded signed transaction data
|
|
208
|
+
* @returns Deserialized signed transaction
|
|
209
|
+
*/
|
|
210
|
+
export function deserializeSignedTransaction(data) {
|
|
211
|
+
try {
|
|
212
|
+
const decoded = cbor.decode(data);
|
|
213
|
+
return {
|
|
214
|
+
txHash: decoded.txHash || '',
|
|
215
|
+
signedTx: decoded.signedTx || '',
|
|
216
|
+
signature: decoded.signature,
|
|
217
|
+
request: decoded.request,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
222
|
+
throw new Error(`Failed to deserialize signed transaction: ${message}`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Calculate checksum for data integrity
|
|
227
|
+
*
|
|
228
|
+
* @param data - Data to checksum
|
|
229
|
+
* @returns 4-byte checksum
|
|
230
|
+
*/
|
|
231
|
+
function calculateChecksum(data) {
|
|
232
|
+
let checksum = 0;
|
|
233
|
+
for (let i = 0; i < data.length; i++) {
|
|
234
|
+
const byte = data[i];
|
|
235
|
+
if (byte !== undefined) {
|
|
236
|
+
checksum = ((checksum << 8) ^ byte) >>> 0;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
const result = new Uint8Array(4);
|
|
240
|
+
const view = new DataView(result.buffer);
|
|
241
|
+
view.setUint32(0, checksum, false); // Big-endian
|
|
242
|
+
return result;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Compare two buffers for equality
|
|
246
|
+
*
|
|
247
|
+
* @param a - First buffer
|
|
248
|
+
* @param b - Second buffer
|
|
249
|
+
* @returns True if buffers are equal
|
|
250
|
+
*/
|
|
251
|
+
function buffersEqual(a, b) {
|
|
252
|
+
if (a.length !== b.length) {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
for (let i = 0; i < a.length; i++) {
|
|
256
|
+
if (a[i] !== b[i]) {
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Validate CBOR data structure
|
|
264
|
+
*
|
|
265
|
+
* @param data - CBOR-encoded data
|
|
266
|
+
* @returns True if data appears valid
|
|
267
|
+
*/
|
|
268
|
+
export function validateCborData(data) {
|
|
269
|
+
try {
|
|
270
|
+
// Attempt to decode
|
|
271
|
+
const decoded = cbor.decode(data);
|
|
272
|
+
// Check if it's an object
|
|
273
|
+
if (!decoded || typeof decoded !== 'object' || decoded === null) {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
catch {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
//# sourceMappingURL=cbor-serializer.js.map
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chain Dispatcher (Phase 5C)
|
|
3
|
+
*
|
|
4
|
+
* Routes transactions to appropriate blockchain providers.
|
|
5
|
+
* Supports ckETH, Polkadot, and Solana chains.
|
|
6
|
+
*/
|
|
7
|
+
import type { WalletData, TransactionRequest, Transaction, ChainType } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Chain dispatcher configuration
|
|
10
|
+
*/
|
|
11
|
+
export interface ChainDispatcherConfig {
|
|
12
|
+
isTestnet?: boolean;
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Chain dispatcher
|
|
17
|
+
*
|
|
18
|
+
* Routes transactions to appropriate blockchain providers based on wallet chain.
|
|
19
|
+
*/
|
|
20
|
+
export declare class ChainDispatcher {
|
|
21
|
+
private providers;
|
|
22
|
+
private config;
|
|
23
|
+
constructor(config?: ChainDispatcherConfig);
|
|
24
|
+
/**
|
|
25
|
+
* Dispatch transaction to appropriate provider
|
|
26
|
+
*
|
|
27
|
+
* @param wallet - Wallet to use for signing
|
|
28
|
+
* @param request - Transaction request
|
|
29
|
+
* @returns Transaction result
|
|
30
|
+
*/
|
|
31
|
+
dispatchTransaction(wallet: WalletData, request: TransactionRequest): Promise<Transaction>;
|
|
32
|
+
/**
|
|
33
|
+
* Sign transaction without broadcasting
|
|
34
|
+
*
|
|
35
|
+
* @param wallet - Wallet to use for signing
|
|
36
|
+
* @param request - Transaction request
|
|
37
|
+
* @returns Signed transaction
|
|
38
|
+
*/
|
|
39
|
+
signTransaction(wallet: WalletData, request: TransactionRequest): Promise<{
|
|
40
|
+
signedTx: string;
|
|
41
|
+
signature: string;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Get wallet balance
|
|
45
|
+
*
|
|
46
|
+
* @param wallet - Wallet to query
|
|
47
|
+
* @returns Wallet balance
|
|
48
|
+
*/
|
|
49
|
+
getBalance(wallet: WalletData): Promise<{
|
|
50
|
+
amount: string;
|
|
51
|
+
denomination: string;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Get transaction history
|
|
55
|
+
*
|
|
56
|
+
* @param wallet - Wallet to query
|
|
57
|
+
* @param limit - Maximum number of transactions
|
|
58
|
+
* @returns Transaction history
|
|
59
|
+
*/
|
|
60
|
+
getTransactionHistory(wallet: WalletData, limit?: number): Promise<Transaction[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Estimate transaction fee
|
|
63
|
+
*
|
|
64
|
+
* @param wallet - Wallet to use
|
|
65
|
+
* @param request - Transaction request
|
|
66
|
+
* @returns Estimated fee
|
|
67
|
+
*/
|
|
68
|
+
estimateFee(wallet: WalletData, request: TransactionRequest): Promise<string>;
|
|
69
|
+
/**
|
|
70
|
+
* Validate address
|
|
71
|
+
*
|
|
72
|
+
* @param address - Address to validate
|
|
73
|
+
* @param chain - Chain to validate against
|
|
74
|
+
* @returns True if valid
|
|
75
|
+
*/
|
|
76
|
+
validateAddress(address: string, chain: ChainType): Promise<boolean>;
|
|
77
|
+
/**
|
|
78
|
+
* Get current block number
|
|
79
|
+
*
|
|
80
|
+
* @param chain - Chain to query
|
|
81
|
+
* @returns Current block number
|
|
82
|
+
*/
|
|
83
|
+
getBlockNumber(chain: ChainType): Promise<number>;
|
|
84
|
+
/**
|
|
85
|
+
* Get transaction by hash
|
|
86
|
+
*
|
|
87
|
+
* @param chain - Chain to query
|
|
88
|
+
* @param txHash - Transaction hash
|
|
89
|
+
* @returns Transaction details
|
|
90
|
+
*/
|
|
91
|
+
getTransaction(chain: ChainType, txHash: string): Promise<Transaction | null>;
|
|
92
|
+
/**
|
|
93
|
+
* Get provider for chain
|
|
94
|
+
*/
|
|
95
|
+
private getProvider;
|
|
96
|
+
/**
|
|
97
|
+
* Connect all providers
|
|
98
|
+
*/
|
|
99
|
+
connectAll(): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Disconnect all providers
|
|
102
|
+
*/
|
|
103
|
+
disconnectAll(): Promise<void>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Create chain dispatcher
|
|
107
|
+
*
|
|
108
|
+
* @param config - Dispatcher configuration
|
|
109
|
+
* @returns Chain dispatcher instance
|
|
110
|
+
*/
|
|
111
|
+
export declare function createChainDispatcher(config?: ChainDispatcherConfig): ChainDispatcher;
|
|
112
|
+
//# sourceMappingURL=chain-dispatcher.d.ts.map
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chain Dispatcher (Phase 5C)
|
|
3
|
+
*
|
|
4
|
+
* Routes transactions to appropriate blockchain providers.
|
|
5
|
+
* Supports ckETH, Polkadot, and Solana chains.
|
|
6
|
+
*/
|
|
7
|
+
import { CkEthProvider } from './providers/cketh-provider.js';
|
|
8
|
+
import { PolkadotProvider } from './providers/polkadot-provider.js';
|
|
9
|
+
import { SolanaProvider } from './providers/solana-provider.js';
|
|
10
|
+
/**
|
|
11
|
+
* Chain dispatcher
|
|
12
|
+
*
|
|
13
|
+
* Routes transactions to appropriate blockchain providers based on wallet chain.
|
|
14
|
+
*/
|
|
15
|
+
export class ChainDispatcher {
|
|
16
|
+
providers;
|
|
17
|
+
config;
|
|
18
|
+
constructor(config = {}) {
|
|
19
|
+
this.config = {
|
|
20
|
+
isTestnet: config.isTestnet ?? false,
|
|
21
|
+
apiKey: config.apiKey,
|
|
22
|
+
};
|
|
23
|
+
this.providers = new Map();
|
|
24
|
+
this.providers.set('cketh', new CkEthProvider({
|
|
25
|
+
chain: 'cketh',
|
|
26
|
+
rpcUrl: '',
|
|
27
|
+
isTestnet: this.config.isTestnet,
|
|
28
|
+
}));
|
|
29
|
+
this.providers.set('polkadot', new PolkadotProvider({
|
|
30
|
+
chain: 'polkadot',
|
|
31
|
+
rpcUrl: '',
|
|
32
|
+
isTestnet: this.config.isTestnet,
|
|
33
|
+
}));
|
|
34
|
+
this.providers.set('solana', new SolanaProvider({
|
|
35
|
+
chain: 'solana',
|
|
36
|
+
rpcUrl: '',
|
|
37
|
+
isTestnet: this.config.isTestnet,
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Dispatch transaction to appropriate provider
|
|
42
|
+
*
|
|
43
|
+
* @param wallet - Wallet to use for signing
|
|
44
|
+
* @param request - Transaction request
|
|
45
|
+
* @returns Transaction result
|
|
46
|
+
*/
|
|
47
|
+
async dispatchTransaction(wallet, request) {
|
|
48
|
+
const provider = this.getProvider(wallet.chain);
|
|
49
|
+
if (!provider) {
|
|
50
|
+
throw new Error(`Unsupported chain: ${wallet.chain}`);
|
|
51
|
+
}
|
|
52
|
+
await provider.connect();
|
|
53
|
+
const tx = await provider.sendTransaction(wallet.address, request);
|
|
54
|
+
return {
|
|
55
|
+
hash: tx.hash,
|
|
56
|
+
from: wallet.address,
|
|
57
|
+
to: request.to,
|
|
58
|
+
amount: request.amount,
|
|
59
|
+
chain: wallet.chain,
|
|
60
|
+
timestamp: Date.now(),
|
|
61
|
+
status: 'pending',
|
|
62
|
+
fee: tx.fee,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Sign transaction without broadcasting
|
|
67
|
+
*
|
|
68
|
+
* @param wallet - Wallet to use for signing
|
|
69
|
+
* @param request - Transaction request
|
|
70
|
+
* @returns Signed transaction
|
|
71
|
+
*/
|
|
72
|
+
async signTransaction(wallet, request) {
|
|
73
|
+
const provider = this.getProvider(wallet.chain);
|
|
74
|
+
if (!provider) {
|
|
75
|
+
throw new Error(`Unsupported chain: ${wallet.chain}`);
|
|
76
|
+
}
|
|
77
|
+
await provider.connect();
|
|
78
|
+
const signed = await provider.signTransaction(request, wallet.privateKey);
|
|
79
|
+
return {
|
|
80
|
+
signedTx: signed.signedTx,
|
|
81
|
+
signature: signed.signature || '',
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Get wallet balance
|
|
86
|
+
*
|
|
87
|
+
* @param wallet - Wallet to query
|
|
88
|
+
* @returns Wallet balance
|
|
89
|
+
*/
|
|
90
|
+
async getBalance(wallet) {
|
|
91
|
+
const provider = this.getProvider(wallet.chain);
|
|
92
|
+
if (!provider) {
|
|
93
|
+
throw new Error(`Unsupported chain: ${wallet.chain}`);
|
|
94
|
+
}
|
|
95
|
+
await provider.connect();
|
|
96
|
+
const balance = await provider.getBalance(wallet.address);
|
|
97
|
+
return {
|
|
98
|
+
amount: balance.amount,
|
|
99
|
+
denomination: balance.denomination,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get transaction history
|
|
104
|
+
*
|
|
105
|
+
* @param wallet - Wallet to query
|
|
106
|
+
* @param limit - Maximum number of transactions
|
|
107
|
+
* @returns Transaction history
|
|
108
|
+
*/
|
|
109
|
+
async getTransactionHistory(wallet, limit = 20) {
|
|
110
|
+
const provider = this.getProvider(wallet.chain);
|
|
111
|
+
if (!provider) {
|
|
112
|
+
throw new Error(`Unsupported chain: ${wallet.chain}`);
|
|
113
|
+
}
|
|
114
|
+
await provider.connect();
|
|
115
|
+
const history = await provider.getTransactionHistory(wallet.address);
|
|
116
|
+
return history.slice(0, limit);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Estimate transaction fee
|
|
120
|
+
*
|
|
121
|
+
* @param wallet - Wallet to use
|
|
122
|
+
* @param request - Transaction request
|
|
123
|
+
* @returns Estimated fee
|
|
124
|
+
*/
|
|
125
|
+
async estimateFee(wallet, request) {
|
|
126
|
+
const provider = this.getProvider(wallet.chain);
|
|
127
|
+
if (!provider) {
|
|
128
|
+
throw new Error(`Unsupported chain: ${wallet.chain}`);
|
|
129
|
+
}
|
|
130
|
+
await provider.connect();
|
|
131
|
+
const fee = await provider.estimateFee(request);
|
|
132
|
+
return fee;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Validate address
|
|
136
|
+
*
|
|
137
|
+
* @param address - Address to validate
|
|
138
|
+
* @param chain - Chain to validate against
|
|
139
|
+
* @returns True if valid
|
|
140
|
+
*/
|
|
141
|
+
async validateAddress(address, chain) {
|
|
142
|
+
const provider = this.getProvider(chain);
|
|
143
|
+
if (!provider) {
|
|
144
|
+
throw new Error(`Unsupported chain: ${chain}`);
|
|
145
|
+
}
|
|
146
|
+
return await provider.validateAddress(address);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Get current block number
|
|
150
|
+
*
|
|
151
|
+
* @param chain - Chain to query
|
|
152
|
+
* @returns Current block number
|
|
153
|
+
*/
|
|
154
|
+
async getBlockNumber(chain) {
|
|
155
|
+
const provider = this.getProvider(chain);
|
|
156
|
+
if (!provider) {
|
|
157
|
+
throw new Error(`Unsupported chain: ${chain}`);
|
|
158
|
+
}
|
|
159
|
+
await provider.connect();
|
|
160
|
+
const block = await provider.getBlockNumber();
|
|
161
|
+
return block;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get transaction by hash
|
|
165
|
+
*
|
|
166
|
+
* @param chain - Chain to query
|
|
167
|
+
* @param txHash - Transaction hash
|
|
168
|
+
* @returns Transaction details
|
|
169
|
+
*/
|
|
170
|
+
async getTransaction(chain, txHash) {
|
|
171
|
+
const provider = this.getProvider(chain);
|
|
172
|
+
if (!provider) {
|
|
173
|
+
throw new Error(`Unsupported chain: ${chain}`);
|
|
174
|
+
}
|
|
175
|
+
await provider.connect();
|
|
176
|
+
const tx = await provider.getTransaction(txHash);
|
|
177
|
+
if (!tx) {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
hash: tx.hash,
|
|
182
|
+
from: tx.from,
|
|
183
|
+
to: tx.to,
|
|
184
|
+
amount: tx.amount,
|
|
185
|
+
chain,
|
|
186
|
+
timestamp: tx.timestamp,
|
|
187
|
+
status: tx.status,
|
|
188
|
+
fee: tx.fee,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Get provider for chain
|
|
193
|
+
*/
|
|
194
|
+
getProvider(chain) {
|
|
195
|
+
const provider = this.providers.get(chain);
|
|
196
|
+
if (!provider) {
|
|
197
|
+
throw new Error(`No provider found for chain: ${chain}`);
|
|
198
|
+
}
|
|
199
|
+
return provider;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Connect all providers
|
|
203
|
+
*/
|
|
204
|
+
async connectAll() {
|
|
205
|
+
const connections = Array.from(this.providers.entries()).map(async ([chain, provider]) => {
|
|
206
|
+
try {
|
|
207
|
+
await provider.connect();
|
|
208
|
+
return { chain, success: true };
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
return { chain, success: false, error };
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
await Promise.all(connections);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Disconnect all providers
|
|
218
|
+
*/
|
|
219
|
+
async disconnectAll() {
|
|
220
|
+
const disconnections = Array.from(this.providers.entries()).map(async ([chain, provider]) => {
|
|
221
|
+
try {
|
|
222
|
+
await provider.disconnect();
|
|
223
|
+
return { chain, success: true };
|
|
224
|
+
}
|
|
225
|
+
catch (error) {
|
|
226
|
+
return { chain, success: false, error };
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
await Promise.all(disconnections);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Create chain dispatcher
|
|
234
|
+
*
|
|
235
|
+
* @param config - Dispatcher configuration
|
|
236
|
+
* @returns Chain dispatcher instance
|
|
237
|
+
*/
|
|
238
|
+
export function createChainDispatcher(config) {
|
|
239
|
+
return new ChainDispatcher(config);
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=chain-dispatcher.js.map
|