@manifest-network/manifest-mcp-browser 0.1.7 → 0.1.9

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.
Files changed (89) hide show
  1. package/README.md +5 -2
  2. package/dist/client.d.ts +5 -2
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +8 -2
  5. package/dist/client.js.map +1 -1
  6. package/dist/config.d.ts.map +1 -1
  7. package/dist/config.js +0 -10
  8. package/dist/config.js.map +1 -1
  9. package/dist/index.d.ts +0 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +4 -8
  12. package/dist/index.js.map +1 -1
  13. package/dist/queries/index.d.ts +1 -0
  14. package/dist/queries/index.d.ts.map +1 -1
  15. package/dist/queries/index.js +1 -0
  16. package/dist/queries/index.js.map +1 -1
  17. package/dist/transactions/bank.d.ts.map +1 -1
  18. package/dist/transactions/bank.js +7 -5
  19. package/dist/transactions/bank.js.map +1 -1
  20. package/dist/transactions/gov.d.ts.map +1 -1
  21. package/dist/transactions/gov.js +7 -5
  22. package/dist/transactions/gov.js.map +1 -1
  23. package/dist/transactions/index.d.ts +1 -0
  24. package/dist/transactions/index.d.ts.map +1 -1
  25. package/dist/transactions/index.js +1 -0
  26. package/dist/transactions/index.js.map +1 -1
  27. package/dist/transactions/utils.d.ts.map +1 -1
  28. package/dist/transactions/utils.js +5 -6
  29. package/dist/transactions/utils.js.map +1 -1
  30. package/dist/types.d.ts +2 -4
  31. package/dist/types.d.ts.map +1 -1
  32. package/dist/types.js.map +1 -1
  33. package/dist/version.d.ts +2 -0
  34. package/dist/version.d.ts.map +1 -0
  35. package/dist/version.js +2 -0
  36. package/dist/version.js.map +1 -0
  37. package/package.json +13 -3
  38. package/.github/workflows/ci.yml +0 -37
  39. package/.github/workflows/publish.yml +0 -53
  40. package/CLAUDE.md +0 -113
  41. package/dist/config.test.d.ts +0 -2
  42. package/dist/config.test.d.ts.map +0 -1
  43. package/dist/config.test.js +0 -251
  44. package/dist/config.test.js.map +0 -1
  45. package/dist/modules.test.d.ts +0 -2
  46. package/dist/modules.test.d.ts.map +0 -1
  47. package/dist/modules.test.js +0 -161
  48. package/dist/modules.test.js.map +0 -1
  49. package/dist/queries/utils.test.d.ts +0 -2
  50. package/dist/queries/utils.test.d.ts.map +0 -1
  51. package/dist/queries/utils.test.js +0 -117
  52. package/dist/queries/utils.test.js.map +0 -1
  53. package/dist/transactions/utils.test.d.ts +0 -2
  54. package/dist/transactions/utils.test.d.ts.map +0 -1
  55. package/dist/transactions/utils.test.js +0 -567
  56. package/dist/transactions/utils.test.js.map +0 -1
  57. package/src/client.ts +0 -288
  58. package/src/config.test.ts +0 -299
  59. package/src/config.ts +0 -174
  60. package/src/cosmos.ts +0 -106
  61. package/src/index.ts +0 -478
  62. package/src/modules.test.ts +0 -191
  63. package/src/modules.ts +0 -470
  64. package/src/queries/auth.ts +0 -97
  65. package/src/queries/bank.ts +0 -99
  66. package/src/queries/billing.ts +0 -124
  67. package/src/queries/distribution.ts +0 -114
  68. package/src/queries/gov.ts +0 -104
  69. package/src/queries/group.ts +0 -146
  70. package/src/queries/index.ts +0 -17
  71. package/src/queries/sku.ts +0 -85
  72. package/src/queries/staking.ts +0 -154
  73. package/src/queries/utils.test.ts +0 -156
  74. package/src/queries/utils.ts +0 -121
  75. package/src/transactions/bank.ts +0 -86
  76. package/src/transactions/billing.ts +0 -286
  77. package/src/transactions/distribution.ts +0 -76
  78. package/src/transactions/gov.ts +0 -164
  79. package/src/transactions/group.ts +0 -458
  80. package/src/transactions/index.ts +0 -8
  81. package/src/transactions/manifest.ts +0 -67
  82. package/src/transactions/sku.ts +0 -232
  83. package/src/transactions/staking.ts +0 -85
  84. package/src/transactions/utils.test.ts +0 -626
  85. package/src/transactions/utils.ts +0 -417
  86. package/src/types.ts +0 -548
  87. package/src/wallet/index.ts +0 -2
  88. package/src/wallet/mnemonic.ts +0 -146
  89. package/tsconfig.json +0 -23
package/src/types.ts DELETED
@@ -1,548 +0,0 @@
1
- import type { OfflineSigner } from '@cosmjs/proto-signing';
2
-
3
- /**
4
- * Rate limiting configuration
5
- */
6
- export interface RateLimitConfig {
7
- /** Maximum requests per second (default: 10) */
8
- readonly requestsPerSecond?: number;
9
- }
10
-
11
- /**
12
- * Configuration for the Manifest MCP Browser server
13
- */
14
- export interface ManifestMCPConfig {
15
- /** Chain ID (e.g., "manifest-ledger-testnet") */
16
- readonly chainId: string;
17
- /** RPC endpoint URL */
18
- readonly rpcUrl: string;
19
- /** Gas price with denomination (e.g., "1.0umfx") */
20
- readonly gasPrice: string;
21
- /** Gas adjustment multiplier (default: 1.3) */
22
- readonly gasAdjustment?: number;
23
- /** Address prefix (e.g., "manifest") */
24
- readonly addressPrefix?: string;
25
- /** Rate limiting configuration */
26
- readonly rateLimit?: RateLimitConfig;
27
- }
28
-
29
- /**
30
- * Wallet provider interface for different wallet implementations
31
- *
32
- * Any wallet that provides an OfflineSigner works (Keplr, Web3Auth, Leap, cosmos-kit, etc.)
33
- */
34
- export interface WalletProvider {
35
- /** Get the wallet's address */
36
- getAddress(): Promise<string>;
37
- /** Get the offline signer for signing transactions */
38
- getSigner(): Promise<OfflineSigner>;
39
- /** Optional: Connect to the wallet */
40
- connect?(): Promise<void>;
41
- /** Optional: Disconnect from the wallet */
42
- disconnect?(): Promise<void>;
43
- }
44
-
45
- /**
46
- * Result from a Cosmos transaction
47
- */
48
- export interface CosmosTxResult {
49
- readonly module: string;
50
- readonly subcommand: string;
51
- readonly transactionHash: string;
52
- readonly code: number;
53
- readonly height: string;
54
- readonly rawLog?: string;
55
- confirmed?: boolean;
56
- confirmationHeight?: string;
57
- readonly gasUsed?: string;
58
- readonly gasWanted?: string;
59
- readonly events?: readonly {
60
- readonly type: string;
61
- readonly attributes: readonly { readonly key: string; readonly value: string }[];
62
- }[];
63
- }
64
-
65
- /**
66
- * Module information for discovery
67
- */
68
- export interface ModuleInfo {
69
- readonly name: string;
70
- readonly description: string;
71
- readonly args?: string; // Usage hint for arguments
72
- }
73
-
74
- /**
75
- * Available modules listing
76
- */
77
- export interface AvailableModules {
78
- readonly queryModules: readonly ModuleInfo[];
79
- readonly txModules: readonly ModuleInfo[];
80
- }
81
-
82
- /**
83
- * Error codes for ManifestMCPError
84
- */
85
- export enum ManifestMCPErrorCode {
86
- // Configuration errors
87
- INVALID_CONFIG = 'INVALID_CONFIG',
88
- MISSING_CONFIG = 'MISSING_CONFIG',
89
-
90
- // Wallet errors
91
- WALLET_NOT_CONNECTED = 'WALLET_NOT_CONNECTED',
92
- WALLET_CONNECTION_FAILED = 'WALLET_CONNECTION_FAILED',
93
- KEPLR_NOT_INSTALLED = 'KEPLR_NOT_INSTALLED',
94
- INVALID_MNEMONIC = 'INVALID_MNEMONIC',
95
-
96
- // Client errors
97
- CLIENT_NOT_INITIALIZED = 'CLIENT_NOT_INITIALIZED',
98
- RPC_CONNECTION_FAILED = 'RPC_CONNECTION_FAILED',
99
-
100
- // Query errors
101
- QUERY_FAILED = 'QUERY_FAILED',
102
- UNSUPPORTED_QUERY = 'UNSUPPORTED_QUERY',
103
- INVALID_ADDRESS = 'INVALID_ADDRESS',
104
-
105
- // Transaction errors
106
- TX_FAILED = 'TX_FAILED',
107
- TX_SIMULATION_FAILED = 'TX_SIMULATION_FAILED',
108
- TX_BROADCAST_FAILED = 'TX_BROADCAST_FAILED',
109
- TX_CONFIRMATION_TIMEOUT = 'TX_CONFIRMATION_TIMEOUT',
110
- UNSUPPORTED_TX = 'UNSUPPORTED_TX',
111
- INSUFFICIENT_FUNDS = 'INSUFFICIENT_FUNDS',
112
-
113
- // Module errors
114
- UNKNOWN_MODULE = 'UNKNOWN_MODULE',
115
- UNKNOWN_SUBCOMMAND = 'UNKNOWN_SUBCOMMAND',
116
-
117
- // General errors
118
- UNKNOWN_ERROR = 'UNKNOWN_ERROR',
119
- }
120
-
121
- /**
122
- * Custom error class for Manifest MCP Browser errors
123
- */
124
- export class ManifestMCPError extends Error {
125
- public readonly code: ManifestMCPErrorCode;
126
- public readonly details?: Record<string, unknown>;
127
-
128
- constructor(
129
- code: ManifestMCPErrorCode,
130
- message: string,
131
- details?: Record<string, unknown>
132
- ) {
133
- super(message);
134
- this.name = 'ManifestMCPError';
135
- this.code = code;
136
- this.details = details;
137
-
138
- // Ensure proper prototype chain for instanceof checks
139
- Object.setPrototypeOf(this, ManifestMCPError.prototype);
140
- }
141
-
142
- toJSON(): Record<string, unknown> {
143
- return {
144
- name: this.name,
145
- code: this.code,
146
- message: this.message,
147
- details: this.details,
148
- };
149
- }
150
- }
151
-
152
- /**
153
- * Account information
154
- */
155
- export interface AccountInfo {
156
- readonly address: string;
157
- }
158
-
159
- // ============================================================================
160
- // Query Result Types
161
- // ============================================================================
162
-
163
- /**
164
- * Pagination response from Cosmos SDK queries
165
- */
166
- export interface PaginationResponse {
167
- readonly nextKey?: Uint8Array;
168
- readonly total?: bigint;
169
- }
170
-
171
- /**
172
- * Base interface for paginated query results
173
- */
174
- export interface PaginatedResult {
175
- readonly pagination?: PaginationResponse;
176
- }
177
-
178
- /**
179
- * Coin type from Cosmos SDK
180
- */
181
- export interface Coin {
182
- readonly denom: string;
183
- readonly amount: string;
184
- }
185
-
186
- /**
187
- * DecCoin type from Cosmos SDK (for rewards, etc.)
188
- */
189
- export interface DecCoin {
190
- readonly denom: string;
191
- readonly amount: string;
192
- }
193
-
194
- // Bank query results
195
- export interface BalanceResult {
196
- readonly balance?: Coin;
197
- }
198
-
199
- export interface BalancesResult extends PaginatedResult {
200
- readonly balances: readonly Coin[];
201
- }
202
-
203
- export interface TotalSupplyResult extends PaginatedResult {
204
- readonly supply: readonly Coin[];
205
- }
206
-
207
- export interface SupplyOfResult {
208
- readonly amount?: Coin;
209
- }
210
-
211
- export interface DenomMetadataResult {
212
- readonly metadata?: unknown;
213
- }
214
-
215
- export interface DenomsMetadataResult extends PaginatedResult {
216
- readonly metadatas: readonly unknown[];
217
- }
218
-
219
- export interface SendEnabledResult extends PaginatedResult {
220
- readonly sendEnabled: readonly unknown[];
221
- }
222
-
223
- export interface BankParamsResult {
224
- readonly params?: unknown;
225
- }
226
-
227
- // Staking query results
228
- export interface DelegationResult {
229
- readonly delegationResponse?: unknown;
230
- }
231
-
232
- export interface DelegationsResult extends PaginatedResult {
233
- readonly delegationResponses: readonly unknown[];
234
- }
235
-
236
- export interface UnbondingDelegationResult {
237
- readonly unbond?: unknown;
238
- }
239
-
240
- export interface UnbondingDelegationsResult extends PaginatedResult {
241
- readonly unbondingResponses: readonly unknown[];
242
- }
243
-
244
- export interface RedelegationsResult extends PaginatedResult {
245
- readonly redelegationResponses: readonly unknown[];
246
- }
247
-
248
- export interface ValidatorResult {
249
- readonly validator?: unknown;
250
- }
251
-
252
- export interface ValidatorsResult extends PaginatedResult {
253
- readonly validators: readonly unknown[];
254
- }
255
-
256
- export interface StakingPoolResult {
257
- readonly pool?: unknown;
258
- }
259
-
260
- export interface StakingParamsResult {
261
- readonly params?: unknown;
262
- }
263
-
264
- export interface HistoricalInfoResult {
265
- readonly hist?: unknown;
266
- }
267
-
268
- // Distribution query results
269
- export interface RewardsResult {
270
- readonly rewards: readonly DecCoin[];
271
- readonly total?: readonly DecCoin[];
272
- }
273
-
274
- export interface CommissionResult {
275
- readonly commission?: unknown;
276
- }
277
-
278
- export interface CommunityPoolResult {
279
- readonly pool: readonly DecCoin[];
280
- }
281
-
282
- export interface DistributionParamsResult {
283
- readonly params?: unknown;
284
- }
285
-
286
- export interface ValidatorOutstandingRewardsResult {
287
- readonly rewards?: unknown;
288
- }
289
-
290
- export interface SlashesResult extends PaginatedResult {
291
- readonly slashes: readonly unknown[];
292
- }
293
-
294
- export interface DelegatorValidatorsResult {
295
- readonly validators: readonly string[];
296
- }
297
-
298
- export interface DelegatorWithdrawAddressResult {
299
- readonly withdrawAddress: string;
300
- }
301
-
302
- // Gov query results
303
- export interface ProposalResult {
304
- readonly proposal?: unknown;
305
- }
306
-
307
- export interface ProposalsResult extends PaginatedResult {
308
- readonly proposals: readonly unknown[];
309
- }
310
-
311
- export interface VoteResult {
312
- readonly vote?: unknown;
313
- }
314
-
315
- export interface VotesResult extends PaginatedResult {
316
- readonly votes: readonly unknown[];
317
- }
318
-
319
- export interface DepositResult {
320
- readonly deposit?: unknown;
321
- }
322
-
323
- export interface DepositsResult extends PaginatedResult {
324
- readonly deposits: readonly unknown[];
325
- }
326
-
327
- export interface TallyResult {
328
- readonly tally?: unknown;
329
- }
330
-
331
- export interface GovParamsResult {
332
- readonly votingParams?: unknown;
333
- readonly depositParams?: unknown;
334
- readonly tallyParams?: unknown;
335
- readonly params?: unknown;
336
- }
337
-
338
- // Auth query results
339
- export interface AuthAccountResult {
340
- readonly account?: unknown;
341
- }
342
-
343
- export interface AuthAccountsResult extends PaginatedResult {
344
- readonly accounts: readonly unknown[];
345
- }
346
-
347
- export interface AuthParamsResult {
348
- readonly params?: unknown;
349
- }
350
-
351
- export interface ModuleAccountsResult {
352
- readonly accounts: readonly unknown[];
353
- }
354
-
355
- export interface AddressBytesToStringResult {
356
- readonly addressString: string;
357
- }
358
-
359
- export interface AddressStringToBytesResult {
360
- readonly addressBytes: string;
361
- }
362
-
363
- export interface Bech32PrefixResult {
364
- readonly bech32Prefix: string;
365
- }
366
-
367
- export interface AccountInfoResult {
368
- readonly info?: unknown;
369
- }
370
-
371
- // Billing query results
372
- export interface BillingParamsResult {
373
- readonly params?: unknown;
374
- }
375
-
376
- export interface LeaseResult {
377
- readonly lease?: unknown;
378
- }
379
-
380
- export interface LeasesResult extends PaginatedResult {
381
- readonly leases: readonly unknown[];
382
- }
383
-
384
- export interface CreditAccountResult {
385
- readonly creditAccount?: unknown;
386
- }
387
-
388
- export interface CreditAccountsResult extends PaginatedResult {
389
- readonly creditAccounts: readonly unknown[];
390
- }
391
-
392
- export interface CreditAddressResult {
393
- readonly creditAddress: string;
394
- }
395
-
396
- export interface WithdrawableAmountResult {
397
- readonly amounts: readonly Coin[];
398
- }
399
-
400
- export interface ProviderWithdrawableResult {
401
- readonly amounts: readonly Coin[];
402
- }
403
-
404
- export interface CreditEstimateResult {
405
- readonly estimate: unknown;
406
- }
407
-
408
- // Group query results
409
- export interface GroupInfoResult {
410
- readonly info?: unknown;
411
- }
412
-
413
- export interface GroupPolicyInfoResult {
414
- readonly info?: unknown;
415
- }
416
-
417
- export interface GroupMembersResult extends PaginatedResult {
418
- readonly members: readonly unknown[];
419
- }
420
-
421
- export interface GroupsResult extends PaginatedResult {
422
- readonly groups: readonly unknown[];
423
- }
424
-
425
- export interface GroupPoliciesResult extends PaginatedResult {
426
- readonly groupPolicies: readonly unknown[];
427
- }
428
-
429
- export interface GroupProposalResult {
430
- readonly proposal?: unknown;
431
- }
432
-
433
- export interface GroupProposalsResult extends PaginatedResult {
434
- readonly proposals: readonly unknown[];
435
- }
436
-
437
- export interface GroupVoteResult {
438
- readonly vote?: unknown;
439
- }
440
-
441
- export interface GroupVotesResult extends PaginatedResult {
442
- readonly votes: readonly unknown[];
443
- }
444
-
445
- export interface GroupTallyResult {
446
- readonly tally?: unknown;
447
- }
448
-
449
- // SKU query results
450
- export interface SkuParamsResult {
451
- readonly params?: unknown;
452
- }
453
-
454
- export interface ProviderResult {
455
- readonly provider?: unknown;
456
- }
457
-
458
- export interface ProvidersResult extends PaginatedResult {
459
- readonly providers: readonly unknown[];
460
- }
461
-
462
- export interface SkuResult {
463
- readonly sku?: unknown;
464
- }
465
-
466
- export interface SkusResult extends PaginatedResult {
467
- readonly skus: readonly unknown[];
468
- }
469
-
470
- /**
471
- * Union type of all query results for type-safe handling
472
- */
473
- export type QueryResult =
474
- | BalanceResult
475
- | BalancesResult
476
- | TotalSupplyResult
477
- | SupplyOfResult
478
- | DenomMetadataResult
479
- | DenomsMetadataResult
480
- | SendEnabledResult
481
- | BankParamsResult
482
- | DelegationResult
483
- | DelegationsResult
484
- | UnbondingDelegationResult
485
- | UnbondingDelegationsResult
486
- | RedelegationsResult
487
- | ValidatorResult
488
- | ValidatorsResult
489
- | StakingPoolResult
490
- | StakingParamsResult
491
- | HistoricalInfoResult
492
- | RewardsResult
493
- | CommissionResult
494
- | CommunityPoolResult
495
- | DistributionParamsResult
496
- | ValidatorOutstandingRewardsResult
497
- | SlashesResult
498
- | DelegatorValidatorsResult
499
- | DelegatorWithdrawAddressResult
500
- | ProposalResult
501
- | ProposalsResult
502
- | VoteResult
503
- | VotesResult
504
- | DepositResult
505
- | DepositsResult
506
- | TallyResult
507
- | GovParamsResult
508
- | AuthAccountResult
509
- | AuthAccountsResult
510
- | AuthParamsResult
511
- | ModuleAccountsResult
512
- | AddressBytesToStringResult
513
- | AddressStringToBytesResult
514
- | Bech32PrefixResult
515
- | AccountInfoResult
516
- | BillingParamsResult
517
- | LeaseResult
518
- | LeasesResult
519
- | CreditAccountResult
520
- | CreditAccountsResult
521
- | CreditAddressResult
522
- | WithdrawableAmountResult
523
- | ProviderWithdrawableResult
524
- | CreditEstimateResult
525
- | SkuParamsResult
526
- | ProviderResult
527
- | ProvidersResult
528
- | SkuResult
529
- | SkusResult
530
- | GroupInfoResult
531
- | GroupPolicyInfoResult
532
- | GroupMembersResult
533
- | GroupsResult
534
- | GroupPoliciesResult
535
- | GroupProposalResult
536
- | GroupProposalsResult
537
- | GroupVoteResult
538
- | GroupVotesResult
539
- | GroupTallyResult;
540
-
541
- /**
542
- * Result from a Cosmos query
543
- */
544
- export interface CosmosQueryResult {
545
- readonly module: string;
546
- readonly subcommand: string;
547
- readonly result: QueryResult;
548
- }
@@ -1,2 +0,0 @@
1
- export type { WalletProvider } from '../types.js';
2
- export { MnemonicWalletProvider } from './mnemonic.js';
@@ -1,146 +0,0 @@
1
- import { DirectSecp256k1HdWallet, OfflineSigner } from '@cosmjs/proto-signing';
2
- import { WalletProvider, ManifestMCPError, ManifestMCPErrorCode, ManifestMCPConfig } from '../types.js';
3
-
4
- /**
5
- * Mnemonic-based wallet provider for non-browser environments or testing
6
- *
7
- * SECURITY NOTE: The mnemonic is stored in memory until disconnect() is called.
8
- * After disconnect(), the wallet cannot be reconnected - create a new instance instead.
9
- */
10
- export class MnemonicWalletProvider implements WalletProvider {
11
- private config: ManifestMCPConfig;
12
- private mnemonic: string | null;
13
- private wallet: DirectSecp256k1HdWallet | null = null;
14
- private address: string | null = null;
15
- private disconnected: boolean = false;
16
-
17
- // Promise to prevent concurrent wallet initialization (lazy init race condition)
18
- private initPromise: Promise<void> | null = null;
19
-
20
- constructor(config: ManifestMCPConfig, mnemonic: string) {
21
- this.config = config;
22
- this.mnemonic = mnemonic;
23
- }
24
-
25
- /**
26
- * Initialize the wallet from the mnemonic
27
- */
28
- private async initWallet(): Promise<void> {
29
- if (this.disconnected) {
30
- throw new ManifestMCPError(
31
- ManifestMCPErrorCode.WALLET_NOT_CONNECTED,
32
- 'Wallet has been disconnected and cannot be reconnected. Create a new MnemonicWalletProvider instance.'
33
- );
34
- }
35
-
36
- // Return if already initialized
37
- if (this.wallet) {
38
- return;
39
- }
40
-
41
- // If initialization is already in progress, wait for it
42
- if (this.initPromise) {
43
- return this.initPromise;
44
- }
45
-
46
- if (!this.mnemonic) {
47
- throw new ManifestMCPError(
48
- ManifestMCPErrorCode.WALLET_NOT_CONNECTED,
49
- 'Mnemonic has been cleared. Create a new MnemonicWalletProvider instance.'
50
- );
51
- }
52
-
53
- // Start initialization and cache the promise to prevent concurrent init
54
- this.initPromise = (async () => {
55
- const prefix = this.config.addressPrefix ?? 'manifest';
56
-
57
- try {
58
- this.wallet = await DirectSecp256k1HdWallet.fromMnemonic(this.mnemonic!, {
59
- prefix,
60
- });
61
-
62
- const accounts = await this.wallet.getAccounts();
63
- if (accounts.length === 0) {
64
- throw new ManifestMCPError(
65
- ManifestMCPErrorCode.INVALID_MNEMONIC,
66
- 'No accounts derived from mnemonic'
67
- );
68
- }
69
-
70
- this.address = accounts[0].address;
71
- // Clear promise after successful init - wallet check will short-circuit future calls
72
- this.initPromise = null;
73
- } catch (error) {
74
- // Clear state on failure so retry is possible
75
- this.initPromise = null;
76
- this.wallet = null;
77
- this.address = null;
78
- if (error instanceof ManifestMCPError) {
79
- throw error;
80
- }
81
- throw new ManifestMCPError(
82
- ManifestMCPErrorCode.INVALID_MNEMONIC,
83
- `Failed to create wallet from mnemonic: ${error instanceof Error ? error.message : String(error)}`
84
- );
85
- }
86
- })();
87
-
88
- return this.initPromise;
89
- }
90
-
91
- /**
92
- * Connect (initialize) the wallet
93
- */
94
- async connect(): Promise<void> {
95
- await this.initWallet();
96
- }
97
-
98
- /**
99
- * Disconnect and securely clear all sensitive data
100
- *
101
- * IMPORTANT: After calling disconnect(), this wallet instance cannot be reused.
102
- * Create a new MnemonicWalletProvider instance if you need to reconnect.
103
- */
104
- async disconnect(): Promise<void> {
105
- // Clear the mnemonic by overwriting with empty string then nullifying
106
- // Note: JavaScript strings are immutable, so we can't truly zero the memory,
107
- // but we can remove all references to allow garbage collection
108
- this.mnemonic = null;
109
- this.wallet = null;
110
- this.address = null;
111
- this.initPromise = null;
112
- this.disconnected = true;
113
- }
114
-
115
- /**
116
- * Get the wallet's address
117
- */
118
- async getAddress(): Promise<string> {
119
- await this.initWallet();
120
-
121
- if (!this.address) {
122
- throw new ManifestMCPError(
123
- ManifestMCPErrorCode.WALLET_NOT_CONNECTED,
124
- 'Wallet failed to initialize'
125
- );
126
- }
127
-
128
- return this.address;
129
- }
130
-
131
- /**
132
- * Get the offline signer for signing transactions
133
- */
134
- async getSigner(): Promise<OfflineSigner> {
135
- await this.initWallet();
136
-
137
- if (!this.wallet) {
138
- throw new ManifestMCPError(
139
- ManifestMCPErrorCode.WALLET_NOT_CONNECTED,
140
- 'Wallet failed to initialize'
141
- );
142
- }
143
-
144
- return this.wallet;
145
- }
146
- }
package/tsconfig.json DELETED
@@ -1,23 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "ES2020",
5
- "lib": ["ES2020", "DOM"],
6
- "outDir": "./dist",
7
- "rootDir": "./src",
8
- "strict": true,
9
- "noUnusedLocals": true,
10
- "noUnusedParameters": true,
11
- "noFallthroughCasesInSwitch": true,
12
- "esModuleInterop": true,
13
- "skipLibCheck": true,
14
- "forceConsistentCasingInFileNames": true,
15
- "moduleResolution": "node",
16
- "resolveJsonModule": true,
17
- "declaration": true,
18
- "declarationMap": true,
19
- "sourceMap": true
20
- },
21
- "include": ["src/**/*"],
22
- "exclude": ["node_modules", "dist"]
23
- }