agentvault 1.0.0
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/.dfx/local/network-id +4 -0
- package/.next/trace +2 -0
- package/.vercel/README.txt +11 -0
- package/.vercel/project.json +1 -0
- package/AGENTS.md +43 -0
- package/CHANGELOG.md +196 -0
- package/LICENSE +21 -0
- package/PLAN_VAULT_INTEGRATION.md +318 -0
- package/README.md +253 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T17-54-28-967Z.json +28 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T17-54-29-032Z.backup +1 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T17-57-42-373Z.json +28 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T17-57-42-428Z.backup +1 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T18-52-25-132Z.json +28 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T18-52-25-247Z.backup +1 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T18-54-09-216Z.json +28 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T18-54-09-283Z.backup +1 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T22-18-22-772Z.backup +1 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T22-18-22-793Z.json +28 -0
- package/backups/test-backup.json +28 -0
- package/dist/cli/commands/approve.d.ts +4 -0
- package/dist/cli/commands/approve.js +232 -0
- package/dist/cli/commands/archive.d.ts +4 -0
- package/dist/cli/commands/archive.js +192 -0
- package/dist/cli/commands/backup.d.ts +4 -0
- package/dist/cli/commands/backup.js +164 -0
- package/dist/cli/commands/cloud-backup.d.ts +4 -0
- package/dist/cli/commands/cloud-backup.js +221 -0
- package/dist/cli/commands/cycles.d.ts +8 -0
- package/dist/cli/commands/cycles.js +83 -0
- package/dist/cli/commands/decrypt.d.ts +16 -0
- package/dist/cli/commands/decrypt.js +101 -0
- package/dist/cli/commands/deploy.d.ts +32 -0
- package/dist/cli/commands/deploy.js +208 -0
- package/dist/cli/commands/exec.d.ts +26 -0
- package/dist/cli/commands/exec.js +109 -0
- package/dist/cli/commands/fetch.d.ts +23 -0
- package/dist/cli/commands/fetch.js +164 -0
- package/dist/cli/commands/health.d.ts +8 -0
- package/dist/cli/commands/health.js +72 -0
- package/dist/cli/commands/identity.d.ts +8 -0
- package/dist/cli/commands/identity.js +140 -0
- package/dist/cli/commands/inference.d.ts +4 -0
- package/dist/cli/commands/inference.js +225 -0
- package/dist/cli/commands/info.d.ts +8 -0
- package/dist/cli/commands/info.js +59 -0
- package/dist/cli/commands/init.d.ts +19 -0
- package/dist/cli/commands/init.js +135 -0
- package/dist/cli/commands/instrument.d.ts +8 -0
- package/dist/cli/commands/instrument.js +35 -0
- package/dist/cli/commands/list.d.ts +36 -0
- package/dist/cli/commands/list.js +173 -0
- package/dist/cli/commands/logs.d.ts +8 -0
- package/dist/cli/commands/logs.js +96 -0
- package/dist/cli/commands/monitor.d.ts +8 -0
- package/dist/cli/commands/monitor.js +84 -0
- package/dist/cli/commands/network.d.ts +14 -0
- package/dist/cli/commands/network.js +258 -0
- package/dist/cli/commands/package.d.ts +36 -0
- package/dist/cli/commands/package.js +188 -0
- package/dist/cli/commands/profile.d.ts +8 -0
- package/dist/cli/commands/profile.js +76 -0
- package/dist/cli/commands/promote.d.ts +8 -0
- package/dist/cli/commands/promote.js +89 -0
- package/dist/cli/commands/rebuild.d.ts +21 -0
- package/dist/cli/commands/rebuild.js +140 -0
- package/dist/cli/commands/rollback.d.ts +8 -0
- package/dist/cli/commands/rollback.js +120 -0
- package/dist/cli/commands/show.d.ts +36 -0
- package/dist/cli/commands/show.js +200 -0
- package/dist/cli/commands/stats.d.ts +8 -0
- package/dist/cli/commands/stats.js +34 -0
- package/dist/cli/commands/status.d.ts +14 -0
- package/dist/cli/commands/status.js +83 -0
- package/dist/cli/commands/test.d.ts +8 -0
- package/dist/cli/commands/test.js +109 -0
- package/dist/cli/commands/tokens.d.ts +8 -0
- package/dist/cli/commands/tokens.js +62 -0
- package/dist/cli/commands/trace.d.ts +8 -0
- package/dist/cli/commands/trace.js +68 -0
- package/dist/cli/commands/wallet-export.d.ts +13 -0
- package/dist/cli/commands/wallet-export.js +140 -0
- package/dist/cli/commands/wallet-history.d.ts +10 -0
- package/dist/cli/commands/wallet-history.js +127 -0
- package/dist/cli/commands/wallet-import.d.ts +10 -0
- package/dist/cli/commands/wallet-import.js +209 -0
- package/dist/cli/commands/wallet-multi-send.d.ts +17 -0
- package/dist/cli/commands/wallet-multi-send.js +195 -0
- package/dist/cli/commands/wallet-process-queue.d.ts +19 -0
- package/dist/cli/commands/wallet-process-queue.js +209 -0
- package/dist/cli/commands/wallet-sign.d.ts +13 -0
- package/dist/cli/commands/wallet-sign.js +207 -0
- package/dist/cli/commands/wallet.d.ts +12 -0
- package/dist/cli/commands/wallet.js +794 -0
- package/dist/cli/index.d.ts +10 -0
- package/dist/cli/index.js +96 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.js +14 -0
- package/fixup_1_0_OSS_release.md +136 -0
- package/fixup_REALEASE_PRD.md +136 -0
- package/package.json +79 -0
- package/pnpm-workspace.yaml +5 -0
- package/scripts/dev-dashboard.mjs +84 -0
- package/site/README.md +63 -0
- package/site/docusaurus.config.ts +148 -0
- package/site/package-lock.json +18383 -0
- package/site/package.json +47 -0
- package/site/sidebars.ts +86 -0
- package/site/static/.gitkeep +0 -0
- package/site/static/img/logo.svg +28 -0
- package/site/static/img/og-image.svg +35 -0
- package/src/archival/archive-manager.ts +372 -0
- package/src/archival/arweave-client.ts +289 -0
- package/src/archival/index.ts +8 -0
- package/src/backup/backup.ts +315 -0
- package/src/backup/index.ts +7 -0
- package/src/cloud-storage/cloud-sync.ts +461 -0
- package/src/cloud-storage/index.ts +11 -0
- package/src/cloud-storage/provider-detector.ts +198 -0
- package/src/cloud-storage/types.ts +104 -0
- package/src/debugging/index.ts +6 -0
- package/src/debugging/logs.ts +193 -0
- package/src/debugging/types.ts +100 -0
- package/src/deployment/deployer.ts +274 -0
- package/src/deployment/icpClient.ts +620 -0
- package/src/deployment/index.ts +46 -0
- package/src/deployment/promotion.ts +161 -0
- package/src/deployment/types.ts +111 -0
- package/src/icp/batch.ts +374 -0
- package/src/icp/cycles.ts +50 -0
- package/src/icp/environment.ts +215 -0
- package/src/icp/icpcli.ts +438 -0
- package/src/icp/icwasm.ts +222 -0
- package/src/icp/identity.ts +77 -0
- package/src/icp/index.ts +94 -0
- package/src/icp/optimization.ts +242 -0
- package/src/icp/tokens.ts +36 -0
- package/src/icp/tool-detector.ts +110 -0
- package/src/icp/types.ts +574 -0
- package/src/index.ts +25 -0
- package/src/inference/bittensor-client.ts +304 -0
- package/src/inference/index.ts +8 -0
- package/src/inference/inference-manager.ts +327 -0
- package/src/metrics/index.ts +7 -0
- package/src/metrics/metrics.ts +186 -0
- package/src/monitoring/alerting.ts +190 -0
- package/src/monitoring/health.ts +197 -0
- package/src/monitoring/index.ts +38 -0
- package/src/monitoring/info.ts +114 -0
- package/src/monitoring/types.ts +99 -0
- package/src/network/index.ts +5 -0
- package/src/network/network-config.ts +129 -0
- package/src/packaging/compiler.ts +647 -0
- package/src/packaging/config-persistence.ts +135 -0
- package/src/packaging/config-schemas.ts +156 -0
- package/src/packaging/detector.ts +220 -0
- package/src/packaging/index.ts +90 -0
- package/src/packaging/packager.ts +118 -0
- package/src/packaging/parsers/clawdbot.ts +278 -0
- package/src/packaging/parsers/cline.ts +223 -0
- package/src/packaging/parsers/generic.ts +266 -0
- package/src/packaging/parsers/goose.ts +214 -0
- package/src/packaging/parsers/index.ts +11 -0
- package/src/packaging/serializer.ts +260 -0
- package/src/packaging/types.ts +144 -0
- package/src/packaging/wasmedge-compiler.ts +406 -0
- package/src/security/index.ts +17 -0
- package/src/security/multisig.ts +415 -0
- package/src/security/types.ts +416 -0
- package/src/security/vetkeys.ts +655 -0
- package/src/testing/index.ts +6 -0
- package/src/testing/local-runner.ts +264 -0
- package/src/testing/types.ts +104 -0
- package/src/wallet/cbor-serializer.ts +323 -0
- package/src/wallet/chain-dispatcher.ts +313 -0
- package/src/wallet/cross-chain-aggregator.ts +346 -0
- package/src/wallet/index.ts +76 -0
- package/src/wallet/key-derivation.ts +425 -0
- package/src/wallet/providers/base-provider.ts +154 -0
- package/src/wallet/providers/cketh-provider.ts +434 -0
- package/src/wallet/providers/polkadot-provider.ts +503 -0
- package/src/wallet/providers/solana-provider.ts +490 -0
- package/src/wallet/transaction-queue.ts +284 -0
- package/src/wallet/types.ts +178 -0
- package/src/wallet/vetkeys-adapter.ts +431 -0
- package/src/wallet/wallet-manager.ts +597 -0
- package/src/wallet/wallet-storage.ts +380 -0
- package/vercel.json +8 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transaction Queue Processor (Phase 5B)
|
|
3
|
+
*
|
|
4
|
+
* Advanced transaction queue with priority, retries, and scheduling.
|
|
5
|
+
* Handles agent-initiated transactions queued in canister.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type {
|
|
9
|
+
WalletData,
|
|
10
|
+
TransactionRequest,
|
|
11
|
+
SignedTransaction,
|
|
12
|
+
} from './types.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Transaction action type
|
|
16
|
+
*/
|
|
17
|
+
export type TransactionAction = 'send_funds' | 'sign_message' | 'deploy_contract';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Transaction priority
|
|
21
|
+
*/
|
|
22
|
+
export type TransactionPriority = 'low' | 'normal' | 'high';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Transaction status
|
|
26
|
+
*/
|
|
27
|
+
export type TransactionStatus = 'pending' | 'queued' | 'signed' | 'completed' | 'failed';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Queued transaction from canister
|
|
31
|
+
*/
|
|
32
|
+
export interface QueuedTransaction {
|
|
33
|
+
id: string;
|
|
34
|
+
action: {
|
|
35
|
+
walletId: string;
|
|
36
|
+
action: TransactionAction;
|
|
37
|
+
parameters: [string, string][];
|
|
38
|
+
priority: TransactionPriority;
|
|
39
|
+
threshold?: number;
|
|
40
|
+
};
|
|
41
|
+
status: TransactionStatus;
|
|
42
|
+
result?: string;
|
|
43
|
+
retryCount: number;
|
|
44
|
+
scheduledAt?: number;
|
|
45
|
+
createdAt: number;
|
|
46
|
+
signedAt?: number;
|
|
47
|
+
completedAt?: number;
|
|
48
|
+
errorMessage?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Queue statistics
|
|
53
|
+
*/
|
|
54
|
+
export interface QueueStats {
|
|
55
|
+
total: number;
|
|
56
|
+
pending: number;
|
|
57
|
+
queued: number;
|
|
58
|
+
signed: number;
|
|
59
|
+
completed: number;
|
|
60
|
+
failed: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Process result
|
|
65
|
+
*/
|
|
66
|
+
export interface ProcessResult {
|
|
67
|
+
transactionId: string;
|
|
68
|
+
success: boolean;
|
|
69
|
+
txHash?: string;
|
|
70
|
+
error?: string;
|
|
71
|
+
processedAt: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Transaction queue processor
|
|
76
|
+
*/
|
|
77
|
+
export class TransactionQueueProcessor {
|
|
78
|
+
private actor: any;
|
|
79
|
+
private maxRetries: number;
|
|
80
|
+
|
|
81
|
+
constructor(_canisterId: string, actor: any, options?: { maxRetries?: number; retryDelay?: number }) {
|
|
82
|
+
this.actor = actor;
|
|
83
|
+
this.maxRetries = options?.maxRetries ?? 3;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Fetch pending transactions from canister
|
|
88
|
+
*/
|
|
89
|
+
async fetchPendingTransactions(): Promise<QueuedTransaction[]> {
|
|
90
|
+
try {
|
|
91
|
+
return await this.actor.getPendingTransactions();
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error('Failed to fetch pending transactions:', error);
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Process all pending transactions
|
|
100
|
+
*
|
|
101
|
+
* @param signCallback - Callback to sign transactions
|
|
102
|
+
* @returns Processing results
|
|
103
|
+
*/
|
|
104
|
+
async processPendingTransactions(
|
|
105
|
+
signCallback: (wallet: WalletData, action: TransactionRequest) => Promise<SignedTransaction | null>
|
|
106
|
+
): Promise<ProcessResult[]> {
|
|
107
|
+
const pending = await this.fetchPendingTransactions();
|
|
108
|
+
const results: ProcessResult[] = [];
|
|
109
|
+
|
|
110
|
+
for (const tx of pending) {
|
|
111
|
+
const result = await this.processTransaction(tx, signCallback);
|
|
112
|
+
results.push(result);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return results;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Process a single transaction
|
|
120
|
+
*/
|
|
121
|
+
private async processTransaction(
|
|
122
|
+
tx: QueuedTransaction,
|
|
123
|
+
signCallback: (wallet: WalletData, action: TransactionRequest) => Promise<SignedTransaction | null>
|
|
124
|
+
): Promise<ProcessResult> {
|
|
125
|
+
const { getWallet } = await import('./wallet-manager.js');
|
|
126
|
+
const wallet = getWallet('', tx.action.walletId);
|
|
127
|
+
|
|
128
|
+
if (!wallet) {
|
|
129
|
+
await this.markFailed(tx.id, 'Wallet not found');
|
|
130
|
+
return {
|
|
131
|
+
transactionId: tx.id,
|
|
132
|
+
success: false,
|
|
133
|
+
error: 'Wallet not found',
|
|
134
|
+
processedAt: Date.now(),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
try {
|
|
139
|
+
const action = this.mapActionToRequest(tx.action);
|
|
140
|
+
|
|
141
|
+
const signed = await signCallback(wallet, action);
|
|
142
|
+
|
|
143
|
+
if (!signed) {
|
|
144
|
+
await this.markFailed(tx.id, 'Signing failed');
|
|
145
|
+
return {
|
|
146
|
+
transactionId: tx.id,
|
|
147
|
+
success: false,
|
|
148
|
+
error: 'Signing failed',
|
|
149
|
+
processedAt: Date.now(),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
await this.markSigned(tx.id, signed.signature || '');
|
|
154
|
+
|
|
155
|
+
return {
|
|
156
|
+
transactionId: tx.id,
|
|
157
|
+
success: true,
|
|
158
|
+
txHash: signed.txHash,
|
|
159
|
+
processedAt: Date.now(),
|
|
160
|
+
};
|
|
161
|
+
} catch (error) {
|
|
162
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
163
|
+
|
|
164
|
+
if (tx.retryCount < this.maxRetries) {
|
|
165
|
+
await this.actor.retryTransaction(tx.id);
|
|
166
|
+
} else {
|
|
167
|
+
await this.markFailed(tx.id, message);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
transactionId: tx.id,
|
|
172
|
+
success: false,
|
|
173
|
+
error: message,
|
|
174
|
+
processedAt: Date.now(),
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Map canister action to transaction request
|
|
181
|
+
*/
|
|
182
|
+
private mapActionToRequest(action: QueuedTransaction['action']): TransactionRequest {
|
|
183
|
+
const params = new Map(action.parameters);
|
|
184
|
+
|
|
185
|
+
return {
|
|
186
|
+
to: params.get('to') || '',
|
|
187
|
+
amount: params.get('amount') || '0',
|
|
188
|
+
chain: (params.get('chain') || 'cketh') as any,
|
|
189
|
+
memo: params.get('memo'),
|
|
190
|
+
gasPrice: params.get('gasPrice'),
|
|
191
|
+
gasLimit: params.get('gasLimit'),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Mark transaction as signed in canister
|
|
197
|
+
*/
|
|
198
|
+
private async markSigned(txId: string, signature: string): Promise<void> {
|
|
199
|
+
try {
|
|
200
|
+
await this.actor.markTransactionSigned(txId, signature);
|
|
201
|
+
} catch (error) {
|
|
202
|
+
console.error('Failed to mark transaction as signed:', error);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Mark transaction as failed in canister
|
|
208
|
+
*/
|
|
209
|
+
private async markFailed(txId: string, error: string): Promise<void> {
|
|
210
|
+
try {
|
|
211
|
+
await this.actor.markTransactionFailed(txId, error);
|
|
212
|
+
} catch (err) {
|
|
213
|
+
console.error('Failed to mark transaction as failed:', err);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Mark transaction as completed in canister
|
|
219
|
+
*/
|
|
220
|
+
async markCompleted(txId: string, txHash: string): Promise<void> {
|
|
221
|
+
try {
|
|
222
|
+
await this.actor.markTransactionCompleted(txId, txHash);
|
|
223
|
+
} catch (error) {
|
|
224
|
+
console.error('Failed to mark transaction as completed:', error);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Get queue statistics
|
|
230
|
+
*/
|
|
231
|
+
async getStats(): Promise<QueueStats | null> {
|
|
232
|
+
try {
|
|
233
|
+
return await this.actor.getTransactionQueueStats();
|
|
234
|
+
} catch (error) {
|
|
235
|
+
console.error('Failed to get queue stats:', error);
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Schedule transaction for future execution
|
|
242
|
+
*/
|
|
243
|
+
async scheduleTransaction(txId: string, scheduledAt: Date): Promise<{ success: boolean; error?: string }> {
|
|
244
|
+
try {
|
|
245
|
+
await this.actor.scheduleTransaction(txId, BigInt(scheduledAt.getTime()));
|
|
246
|
+
return { success: true };
|
|
247
|
+
} catch (error) {
|
|
248
|
+
return {
|
|
249
|
+
success: false,
|
|
250
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Clear completed transactions
|
|
257
|
+
*/
|
|
258
|
+
async clearCompleted(): Promise<{ success: boolean; error?: string }> {
|
|
259
|
+
try {
|
|
260
|
+
await this.actor.clearCompletedTransactions();
|
|
261
|
+
return { success: true };
|
|
262
|
+
} catch (error) {
|
|
263
|
+
return {
|
|
264
|
+
success: false,
|
|
265
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Create transaction queue processor
|
|
273
|
+
*
|
|
274
|
+
* @param canisterId - Canister ID
|
|
275
|
+
* @param actor - Canister actor instance
|
|
276
|
+
* @returns Queue processor instance
|
|
277
|
+
*/
|
|
278
|
+
export function createQueueProcessor(
|
|
279
|
+
canisterId: string,
|
|
280
|
+
actor: any,
|
|
281
|
+
options?: { maxRetries?: number; retryDelay?: number }
|
|
282
|
+
): TransactionQueueProcessor {
|
|
283
|
+
return new TransactionQueueProcessor(canisterId, actor, options);
|
|
284
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for wallet operations
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Supported blockchain types
|
|
7
|
+
*/
|
|
8
|
+
export type ChainType = 'cketh' | 'polkadot' | 'solana';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wallet creation methods
|
|
12
|
+
*/
|
|
13
|
+
export type WalletCreationMethod = 'seed' | 'private-key' | 'mnemonic';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Derivation path for BIP39 seed phrases
|
|
17
|
+
*/
|
|
18
|
+
export type DerivationPath = string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Wallet data structure (stored encrypted)
|
|
22
|
+
*/
|
|
23
|
+
export interface WalletData {
|
|
24
|
+
/** Unique wallet ID */
|
|
25
|
+
id: string;
|
|
26
|
+
/** Associated agent ID (for per-agent isolation) */
|
|
27
|
+
agentId: string;
|
|
28
|
+
/** Blockchain network */
|
|
29
|
+
chain: ChainType;
|
|
30
|
+
/** Public address */
|
|
31
|
+
address: string;
|
|
32
|
+
/** Encrypted private key (if available) */
|
|
33
|
+
privateKey?: string;
|
|
34
|
+
/** Encrypted mnemonic phrase (if available) */
|
|
35
|
+
mnemonic?: string;
|
|
36
|
+
/** BIP39 derivation path */
|
|
37
|
+
seedDerivationPath?: DerivationPath;
|
|
38
|
+
/** Creation timestamp */
|
|
39
|
+
createdAt: number;
|
|
40
|
+
/** Last update timestamp */
|
|
41
|
+
updatedAt: number;
|
|
42
|
+
/** Wallet creation method */
|
|
43
|
+
creationMethod: WalletCreationMethod;
|
|
44
|
+
/** Chain-specific metadata */
|
|
45
|
+
chainMetadata?: Record<string, any>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Wallet connection status
|
|
50
|
+
*/
|
|
51
|
+
export interface WalletConnection {
|
|
52
|
+
/** Wallet ID */
|
|
53
|
+
walletId: string;
|
|
54
|
+
/** Connection status */
|
|
55
|
+
connected: boolean;
|
|
56
|
+
/** Chain-specific provider instance */
|
|
57
|
+
provider: any;
|
|
58
|
+
/** Connection timestamp */
|
|
59
|
+
connectedAt?: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Transaction data
|
|
64
|
+
*/
|
|
65
|
+
export interface Transaction {
|
|
66
|
+
/** Transaction hash */
|
|
67
|
+
hash: string;
|
|
68
|
+
/** From address */
|
|
69
|
+
from: string;
|
|
70
|
+
/** To address */
|
|
71
|
+
to: string;
|
|
72
|
+
/** Amount (as string to handle large numbers) */
|
|
73
|
+
amount: string;
|
|
74
|
+
/** Blockchain network */
|
|
75
|
+
chain: ChainType;
|
|
76
|
+
/** Transaction timestamp */
|
|
77
|
+
timestamp: number;
|
|
78
|
+
/** Transaction status */
|
|
79
|
+
status: 'pending' | 'confirmed' | 'failed';
|
|
80
|
+
/** Transaction fee */
|
|
81
|
+
fee?: string;
|
|
82
|
+
/** Additional data (memo, etc.) */
|
|
83
|
+
data?: any;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Wallet balance
|
|
88
|
+
*/
|
|
89
|
+
export interface Balance {
|
|
90
|
+
/** Amount (as string to handle large numbers) */
|
|
91
|
+
amount: string;
|
|
92
|
+
/** Denomination (ETH, DOT, SOL, etc.) */
|
|
93
|
+
denomination: string;
|
|
94
|
+
/** Blockchain network */
|
|
95
|
+
chain: ChainType;
|
|
96
|
+
/** Wallet address */
|
|
97
|
+
address: string;
|
|
98
|
+
/** Block number (if available) */
|
|
99
|
+
blockNumber?: number;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Transaction request
|
|
104
|
+
*/
|
|
105
|
+
export interface TransactionRequest {
|
|
106
|
+
/** Destination address */
|
|
107
|
+
to: string;
|
|
108
|
+
/** Amount to send (as string) */
|
|
109
|
+
amount: string;
|
|
110
|
+
/** Chain network */
|
|
111
|
+
chain: ChainType;
|
|
112
|
+
/** Optional memo (Solana) */
|
|
113
|
+
memo?: string;
|
|
114
|
+
/** Optional gas price (Ethereum/Polkadot) */
|
|
115
|
+
gasPrice?: string;
|
|
116
|
+
/** Optional gas limit (Ethereum/Polkadot) */
|
|
117
|
+
gasLimit?: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Signed transaction data
|
|
122
|
+
*/
|
|
123
|
+
export interface SignedTransaction {
|
|
124
|
+
/** Signed transaction hash */
|
|
125
|
+
txHash: string;
|
|
126
|
+
/** Raw signed transaction (hex/base58) */
|
|
127
|
+
signedTx: string;
|
|
128
|
+
/** Signature */
|
|
129
|
+
signature?: string;
|
|
130
|
+
/** Transaction request that was signed */
|
|
131
|
+
request: TransactionRequest;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Wallet creation options
|
|
136
|
+
*/
|
|
137
|
+
export interface WalletCreationOptions {
|
|
138
|
+
/** Agent ID to associate wallet with */
|
|
139
|
+
agentId: string;
|
|
140
|
+
/** Blockchain network */
|
|
141
|
+
chain: ChainType;
|
|
142
|
+
/** Wallet creation method */
|
|
143
|
+
method: WalletCreationMethod;
|
|
144
|
+
/** Seed phrase (for 'seed' and 'mnemonic' methods) */
|
|
145
|
+
seedPhrase?: string;
|
|
146
|
+
/** Private key (for 'private-key' method) */
|
|
147
|
+
privateKey?: string;
|
|
148
|
+
/** BIP39 derivation path */
|
|
149
|
+
derivationPath?: DerivationPath;
|
|
150
|
+
/** Optional custom wallet ID */
|
|
151
|
+
walletId?: string;
|
|
152
|
+
/** Optional chain-specific metadata */
|
|
153
|
+
chainMetadata?: Record<string, any>;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Wallet storage options
|
|
158
|
+
*/
|
|
159
|
+
export interface WalletStorageOptions {
|
|
160
|
+
/** Base directory for wallet storage */
|
|
161
|
+
baseDir?: string;
|
|
162
|
+
/** Enable encryption */
|
|
163
|
+
encrypt?: boolean;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Provider configuration
|
|
168
|
+
*/
|
|
169
|
+
export interface ProviderConfig {
|
|
170
|
+
/** Blockchain network */
|
|
171
|
+
chain: ChainType;
|
|
172
|
+
/** RPC endpoint URL */
|
|
173
|
+
rpcUrl?: string;
|
|
174
|
+
/** Testnet or mainnet */
|
|
175
|
+
isTestnet?: boolean;
|
|
176
|
+
/** API key (if required) */
|
|
177
|
+
apiKey?: string;
|
|
178
|
+
}
|