@manifest-network/manifest-mcp-browser 0.1.0 → 0.1.5
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/.github/workflows/publish.yml +4 -2
- package/CLAUDE.md +9 -3
- package/README.md +6 -1
- package/dist/client.d.ts +13 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +105 -9
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +52 -7
- package/dist/config.js.map +1 -1
- package/dist/config.test.js +128 -0
- package/dist/config.test.js.map +1 -1
- package/dist/cosmos.d.ts.map +1 -1
- package/dist/cosmos.js +11 -57
- package/dist/cosmos.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -25
- package/dist/index.js.map +1 -1
- package/dist/modules.d.ts +30 -1
- package/dist/modules.d.ts.map +1 -1
- package/dist/modules.js +67 -3
- package/dist/modules.js.map +1 -1
- package/dist/modules.test.js +58 -1
- package/dist/modules.test.js.map +1 -1
- package/dist/queries/auth.d.ts +7 -1
- package/dist/queries/auth.d.ts.map +1 -1
- package/dist/queries/auth.js +18 -45
- package/dist/queries/auth.js.map +1 -1
- package/dist/queries/bank.d.ts +7 -1
- package/dist/queries/bank.d.ts.map +1 -1
- package/dist/queries/bank.js +24 -38
- package/dist/queries/bank.js.map +1 -1
- package/dist/queries/billing.d.ts +7 -1
- package/dist/queries/billing.d.ts.map +1 -1
- package/dist/queries/billing.js +28 -54
- package/dist/queries/billing.js.map +1 -1
- package/dist/queries/distribution.d.ts +7 -1
- package/dist/queries/distribution.d.ts.map +1 -1
- package/dist/queries/distribution.js +18 -36
- package/dist/queries/distribution.js.map +1 -1
- package/dist/queries/gov.d.ts +7 -1
- package/dist/queries/gov.d.ts.map +1 -1
- package/dist/queries/gov.js +24 -41
- package/dist/queries/gov.js.map +1 -1
- package/dist/queries/index.d.ts +2 -1
- package/dist/queries/index.d.ts.map +1 -1
- package/dist/queries/index.js +1 -1
- package/dist/queries/index.js.map +1 -1
- package/dist/queries/staking.d.ts +7 -1
- package/dist/queries/staking.d.ts.map +1 -1
- package/dist/queries/staking.js +36 -59
- package/dist/queries/staking.js.map +1 -1
- package/dist/queries/utils.d.ts +42 -10
- package/dist/queries/utils.d.ts.map +1 -1
- package/dist/queries/utils.js +64 -12
- package/dist/queries/utils.js.map +1 -1
- package/dist/queries/utils.test.js +68 -8
- package/dist/queries/utils.test.js.map +1 -1
- package/dist/transactions/bank.d.ts +2 -2
- package/dist/transactions/bank.d.ts.map +1 -1
- package/dist/transactions/bank.js +9 -18
- package/dist/transactions/bank.js.map +1 -1
- package/dist/transactions/billing.d.ts +2 -2
- package/dist/transactions/billing.d.ts.map +1 -1
- package/dist/transactions/billing.js +52 -34
- package/dist/transactions/billing.js.map +1 -1
- package/dist/transactions/distribution.d.ts +2 -2
- package/dist/transactions/distribution.d.ts.map +1 -1
- package/dist/transactions/distribution.js +7 -13
- package/dist/transactions/distribution.js.map +1 -1
- package/dist/transactions/gov.d.ts +2 -2
- package/dist/transactions/gov.d.ts.map +1 -1
- package/dist/transactions/gov.js +32 -17
- package/dist/transactions/gov.js.map +1 -1
- package/dist/transactions/index.d.ts +1 -1
- package/dist/transactions/index.d.ts.map +1 -1
- package/dist/transactions/index.js +1 -1
- package/dist/transactions/index.js.map +1 -1
- package/dist/transactions/manifest.d.ts +2 -2
- package/dist/transactions/manifest.d.ts.map +1 -1
- package/dist/transactions/manifest.js +7 -14
- package/dist/transactions/manifest.js.map +1 -1
- package/dist/transactions/staking.d.ts +2 -2
- package/dist/transactions/staking.d.ts.map +1 -1
- package/dist/transactions/staking.js +7 -13
- package/dist/transactions/staking.js.map +1 -1
- package/dist/transactions/utils.d.ts +63 -1
- package/dist/transactions/utils.d.ts.map +1 -1
- package/dist/transactions/utils.js +121 -2
- package/dist/transactions/utils.js.map +1 -1
- package/dist/transactions/utils.test.js +351 -1
- package/dist/transactions/utils.test.js.map +1 -1
- package/dist/types.d.ts +212 -8
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/wallet/mnemonic.d.ts +1 -0
- package/dist/wallet/mnemonic.d.ts.map +1 -1
- package/dist/wallet/mnemonic.js +34 -13
- package/dist/wallet/mnemonic.js.map +1 -1
- package/package.json +11 -6
- package/src/client.ts +119 -9
- package/src/config.test.ts +156 -0
- package/src/config.ts +59 -7
- package/src/cosmos.ts +19 -109
- package/src/index.ts +17 -23
- package/src/modules.test.ts +60 -0
- package/src/modules.ts +124 -7
- package/src/queries/auth.ts +35 -74
- package/src/queries/bank.ts +40 -58
- package/src/queries/billing.ts +46 -86
- package/src/queries/distribution.ts +35 -59
- package/src/queries/gov.ts +40 -64
- package/src/queries/index.ts +10 -1
- package/src/queries/staking.ts +55 -91
- package/src/queries/utils.test.ts +103 -8
- package/src/queries/utils.ts +92 -12
- package/src/transactions/bank.ts +9 -33
- package/src/transactions/billing.ts +64 -59
- package/src/transactions/distribution.ts +7 -29
- package/src/transactions/gov.ts +40 -34
- package/src/transactions/index.ts +1 -1
- package/src/transactions/manifest.ts +7 -29
- package/src/transactions/staking.ts +7 -29
- package/src/transactions/utils.test.ts +390 -1
- package/src/transactions/utils.ts +191 -2
- package/src/types.ts +328 -9
- package/src/wallet/mnemonic.ts +41 -17
- package/.claude/settings.local.json +0 -17
- package/dist/browser.d.ts.map +0 -1
- package/dist/browser.js.map +0 -1
- package/dist/queries/manifest.d.ts +0 -10
- package/dist/queries/manifest.d.ts.map +0 -1
- package/dist/queries/manifest.js +0 -14
- package/dist/queries/manifest.js.map +0 -1
- package/dist/wallet/keplr.d.ts.map +0 -1
- package/dist/wallet/keplr.js.map +0 -1
package/src/types.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { OfflineSigner } from '@cosmjs/proto-signing';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Rate limiting configuration
|
|
5
|
+
*/
|
|
6
|
+
export interface RateLimitConfig {
|
|
7
|
+
/** Maximum requests per second (default: 10) */
|
|
8
|
+
readonly requestsPerSecond?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
3
11
|
/**
|
|
4
12
|
* Configuration for the Manifest MCP Browser server
|
|
5
13
|
*/
|
|
@@ -14,6 +22,8 @@ export interface ManifestMCPConfig {
|
|
|
14
22
|
readonly gasAdjustment?: number;
|
|
15
23
|
/** Address prefix (e.g., "manifest") */
|
|
16
24
|
readonly addressPrefix?: string;
|
|
25
|
+
/** Rate limiting configuration */
|
|
26
|
+
readonly rateLimit?: RateLimitConfig;
|
|
17
27
|
}
|
|
18
28
|
|
|
19
29
|
/**
|
|
@@ -32,15 +42,6 @@ export interface WalletProvider {
|
|
|
32
42
|
disconnect?(): Promise<void>;
|
|
33
43
|
}
|
|
34
44
|
|
|
35
|
-
/**
|
|
36
|
-
* Result from a Cosmos query
|
|
37
|
-
*/
|
|
38
|
-
export interface CosmosQueryResult {
|
|
39
|
-
readonly module: string;
|
|
40
|
-
readonly subcommand: string;
|
|
41
|
-
readonly result: Record<string, unknown>;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
45
|
/**
|
|
45
46
|
* Result from a Cosmos transaction
|
|
46
47
|
*/
|
|
@@ -55,6 +56,10 @@ export interface CosmosTxResult {
|
|
|
55
56
|
confirmationHeight?: string;
|
|
56
57
|
readonly gasUsed?: string;
|
|
57
58
|
readonly gasWanted?: string;
|
|
59
|
+
readonly events?: readonly {
|
|
60
|
+
readonly type: string;
|
|
61
|
+
readonly attributes: readonly { readonly key: string; readonly value: string }[];
|
|
62
|
+
}[];
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
/**
|
|
@@ -150,3 +155,317 @@ export class ManifestMCPError extends Error {
|
|
|
150
155
|
export interface AccountInfo {
|
|
151
156
|
readonly address: string;
|
|
152
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
|
+
/**
|
|
409
|
+
* Union type of all query results for type-safe handling
|
|
410
|
+
*/
|
|
411
|
+
export type QueryResult =
|
|
412
|
+
| BalanceResult
|
|
413
|
+
| BalancesResult
|
|
414
|
+
| TotalSupplyResult
|
|
415
|
+
| SupplyOfResult
|
|
416
|
+
| DenomMetadataResult
|
|
417
|
+
| DenomsMetadataResult
|
|
418
|
+
| SendEnabledResult
|
|
419
|
+
| BankParamsResult
|
|
420
|
+
| DelegationResult
|
|
421
|
+
| DelegationsResult
|
|
422
|
+
| UnbondingDelegationResult
|
|
423
|
+
| UnbondingDelegationsResult
|
|
424
|
+
| RedelegationsResult
|
|
425
|
+
| ValidatorResult
|
|
426
|
+
| ValidatorsResult
|
|
427
|
+
| StakingPoolResult
|
|
428
|
+
| StakingParamsResult
|
|
429
|
+
| HistoricalInfoResult
|
|
430
|
+
| RewardsResult
|
|
431
|
+
| CommissionResult
|
|
432
|
+
| CommunityPoolResult
|
|
433
|
+
| DistributionParamsResult
|
|
434
|
+
| ValidatorOutstandingRewardsResult
|
|
435
|
+
| SlashesResult
|
|
436
|
+
| DelegatorValidatorsResult
|
|
437
|
+
| DelegatorWithdrawAddressResult
|
|
438
|
+
| ProposalResult
|
|
439
|
+
| ProposalsResult
|
|
440
|
+
| VoteResult
|
|
441
|
+
| VotesResult
|
|
442
|
+
| DepositResult
|
|
443
|
+
| DepositsResult
|
|
444
|
+
| TallyResult
|
|
445
|
+
| GovParamsResult
|
|
446
|
+
| AuthAccountResult
|
|
447
|
+
| AuthAccountsResult
|
|
448
|
+
| AuthParamsResult
|
|
449
|
+
| ModuleAccountsResult
|
|
450
|
+
| AddressBytesToStringResult
|
|
451
|
+
| AddressStringToBytesResult
|
|
452
|
+
| Bech32PrefixResult
|
|
453
|
+
| AccountInfoResult
|
|
454
|
+
| BillingParamsResult
|
|
455
|
+
| LeaseResult
|
|
456
|
+
| LeasesResult
|
|
457
|
+
| CreditAccountResult
|
|
458
|
+
| CreditAccountsResult
|
|
459
|
+
| CreditAddressResult
|
|
460
|
+
| WithdrawableAmountResult
|
|
461
|
+
| ProviderWithdrawableResult
|
|
462
|
+
| CreditEstimateResult;
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Result from a Cosmos query
|
|
466
|
+
*/
|
|
467
|
+
export interface CosmosQueryResult {
|
|
468
|
+
readonly module: string;
|
|
469
|
+
readonly subcommand: string;
|
|
470
|
+
readonly result: QueryResult;
|
|
471
|
+
}
|
package/src/wallet/mnemonic.ts
CHANGED
|
@@ -14,6 +14,9 @@ export class MnemonicWalletProvider implements WalletProvider {
|
|
|
14
14
|
private address: string | null = null;
|
|
15
15
|
private disconnected: boolean = false;
|
|
16
16
|
|
|
17
|
+
// Promise to prevent concurrent wallet initialization (lazy init race condition)
|
|
18
|
+
private initPromise: Promise<void> | null = null;
|
|
19
|
+
|
|
17
20
|
constructor(config: ManifestMCPConfig, mnemonic: string) {
|
|
18
21
|
this.config = config;
|
|
19
22
|
this.mnemonic = mnemonic;
|
|
@@ -30,10 +33,16 @@ export class MnemonicWalletProvider implements WalletProvider {
|
|
|
30
33
|
);
|
|
31
34
|
}
|
|
32
35
|
|
|
36
|
+
// Return if already initialized
|
|
33
37
|
if (this.wallet) {
|
|
34
38
|
return;
|
|
35
39
|
}
|
|
36
40
|
|
|
41
|
+
// If initialization is already in progress, wait for it
|
|
42
|
+
if (this.initPromise) {
|
|
43
|
+
return this.initPromise;
|
|
44
|
+
}
|
|
45
|
+
|
|
37
46
|
if (!this.mnemonic) {
|
|
38
47
|
throw new ManifestMCPError(
|
|
39
48
|
ManifestMCPErrorCode.WALLET_NOT_CONNECTED,
|
|
@@ -41,28 +50,42 @@ export class MnemonicWalletProvider implements WalletProvider {
|
|
|
41
50
|
);
|
|
42
51
|
}
|
|
43
52
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
+
}
|
|
53
81
|
throw new ManifestMCPError(
|
|
54
82
|
ManifestMCPErrorCode.INVALID_MNEMONIC,
|
|
55
|
-
|
|
83
|
+
`Failed to create wallet from mnemonic: ${error instanceof Error ? error.message : String(error)}`
|
|
56
84
|
);
|
|
57
85
|
}
|
|
86
|
+
})();
|
|
58
87
|
|
|
59
|
-
|
|
60
|
-
} catch (error) {
|
|
61
|
-
throw new ManifestMCPError(
|
|
62
|
-
ManifestMCPErrorCode.INVALID_MNEMONIC,
|
|
63
|
-
`Failed to create wallet from mnemonic: ${error instanceof Error ? error.message : String(error)}`
|
|
64
|
-
);
|
|
65
|
-
}
|
|
88
|
+
return this.initPromise;
|
|
66
89
|
}
|
|
67
90
|
|
|
68
91
|
/**
|
|
@@ -85,6 +108,7 @@ export class MnemonicWalletProvider implements WalletProvider {
|
|
|
85
108
|
this.mnemonic = null;
|
|
86
109
|
this.wallet = null;
|
|
87
110
|
this.address = null;
|
|
111
|
+
this.initPromise = null;
|
|
88
112
|
this.disconnected = true;
|
|
89
113
|
}
|
|
90
114
|
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Bash(npm run lint)",
|
|
5
|
-
"Bash(npm install:*)",
|
|
6
|
-
"Bash(npm test:*)",
|
|
7
|
-
"Bash(git init:*)",
|
|
8
|
-
"Bash(npm run build:*)",
|
|
9
|
-
"Bash(find:*)",
|
|
10
|
-
"Bash(node -e:*)",
|
|
11
|
-
"Bash(ls:*)",
|
|
12
|
-
"Bash(git config:*)",
|
|
13
|
-
"WebFetch(domain:docs.npmjs.com)",
|
|
14
|
-
"WebSearch"
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
}
|
package/dist/browser.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,GACZ,MAAM,YAAY,CAAC;A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Q,EAAE,MAAM,aAAa,CAAC;AAEpD,mBAAmB;AACnB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAEtB,aAAa;AACb,OAAO,EAAE,iBAAiB,EAA4B,MAAM,YAAY,CAAC;AAEzE;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,MAO1C;IACC,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;IACzD,MAAM,EAAE,sBAAsB,EAAE,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;IAExE,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,MAAM,CAAC;IAC1C,MAAM,cAAc,GAAG,IAAI,sBAAsB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACvE,MAAM,cAAc,CAAC,OAAO,EAAE,CAAC;IAE/B,OAAO,IAAI,iBAAiB,CAAC;QAC3B,MAAM,EAAE,SAAS;QACjB,cAAc;KACf,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ManifestQueryClient } from '../client.js';
|
|
2
|
-
/**
|
|
3
|
-
* Route manifest module query to manifestjs query client
|
|
4
|
-
* Note: The manifest module currently has no query endpoints defined
|
|
5
|
-
*/
|
|
6
|
-
export declare function routeManifestQuery(_queryClient: ManifestQueryClient, subcommand: string, _args: string[]): Promise<Record<string, unknown>>;
|
|
7
|
-
export declare const manifestQueries: {
|
|
8
|
-
subcommands: never[];
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/queries/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGnD;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,YAAY,EAAE,mBAAmB,EACjC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EAAE,GACd,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAQlC;AAED,eAAO,MAAM,eAAe;;CAE3B,CAAC"}
|
package/dist/queries/manifest.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ManifestMCPError, ManifestMCPErrorCode } from '../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Route manifest module query to manifestjs query client
|
|
4
|
-
* Note: The manifest module currently has no query endpoints defined
|
|
5
|
-
*/
|
|
6
|
-
export async function routeManifestQuery(_queryClient, subcommand, _args) {
|
|
7
|
-
// The manifest module query interface is currently empty
|
|
8
|
-
// This is a placeholder for future manifest-specific queries
|
|
9
|
-
throw new ManifestMCPError(ManifestMCPErrorCode.UNSUPPORTED_QUERY, `Unsupported manifest query subcommand: ${subcommand}. The manifest module currently has no query endpoints.`, { availableSubcommands: [] });
|
|
10
|
-
}
|
|
11
|
-
export const manifestQueries = {
|
|
12
|
-
subcommands: [],
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=manifest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/queries/manifest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAErE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,YAAiC,EACjC,UAAkB,EAClB,KAAe;IAEf,yDAAyD;IACzD,6DAA6D;IAC7D,MAAM,IAAI,gBAAgB,CACxB,oBAAoB,CAAC,iBAAiB,EACtC,0CAA0C,UAAU,yDAAyD,EAC7G,EAAE,oBAAoB,EAAE,EAAE,EAAE,CAC7B,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,WAAW,EAAE,EAAE;CAChB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keplr.d.ts","sourceRoot":"","sources":["../../src/wallet/keplr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,IAAI,WAAW,EAAa,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAA0C,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAExG,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAO,SAAQ,WAAW;KAAG;CACxC;AAED;;GAEG;AACH,qBAAa,mBAAoB,YAAW,cAAc;IACxD,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,MAAM,CAA8B;gBAEhC,MAAM,EAAE,iBAAiB;IAIrC;;OAEG;IACH,OAAO,CAAC,QAAQ;IAkBhB;;OAEG;IACH,OAAO,CAAC,YAAY;IA8CpB;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAkC9B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAKjC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAenC;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC;CAc1C"}
|
package/dist/wallet/keplr.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keplr.js","sourceRoot":"","sources":["../../src/wallet/keplr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,gBAAgB,EAAE,oBAAoB,EAAqB,MAAM,aAAa,CAAC;AAMxG;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAK9B,YAAY,MAAyB;QAH7B,YAAO,GAAkB,IAAI,CAAC;QAC9B,WAAM,GAAyB,IAAI,CAAC;QAG1C,IAAI,CAAC,MAA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