@manifest-network/manifest-mcp-browser 0.1.6 → 0.1.8
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/README.md +5 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +0 -10
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -7
- package/dist/index.js.map +1 -1
- package/dist/modules.d.ts.map +1 -1
- package/dist/modules.js +42 -0
- package/dist/modules.js.map +1 -1
- package/dist/queries/group.d.ts +12 -0
- package/dist/queries/group.d.ts.map +1 -0
- package/dist/queries/group.js +107 -0
- package/dist/queries/group.js.map +1 -0
- package/dist/queries/index.d.ts +2 -0
- package/dist/queries/index.d.ts.map +1 -1
- package/dist/queries/index.js +2 -0
- package/dist/queries/index.js.map +1 -1
- package/dist/queries/utils.d.ts +3 -18
- package/dist/queries/utils.d.ts.map +1 -1
- package/dist/queries/utils.js +2 -17
- package/dist/queries/utils.js.map +1 -1
- package/dist/transactions/bank.d.ts.map +1 -1
- package/dist/transactions/bank.js +7 -5
- package/dist/transactions/bank.js.map +1 -1
- package/dist/transactions/gov.d.ts.map +1 -1
- package/dist/transactions/gov.js +9 -30
- package/dist/transactions/gov.js.map +1 -1
- package/dist/transactions/group.d.ts +7 -0
- package/dist/transactions/group.d.ts.map +1 -0
- package/dist/transactions/group.js +339 -0
- package/dist/transactions/group.js.map +1 -0
- package/dist/transactions/index.d.ts +2 -0
- package/dist/transactions/index.d.ts.map +1 -1
- package/dist/transactions/index.js +2 -0
- package/dist/transactions/index.js.map +1 -1
- package/dist/transactions/utils.d.ts +37 -0
- package/dist/transactions/utils.d.ts.map +1 -1
- package/dist/transactions/utils.js +43 -0
- package/dist/transactions/utils.js.map +1 -1
- package/dist/types.d.ts +31 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +5 -2
- package/.github/workflows/ci.yml +0 -37
- package/.github/workflows/publish.yml +0 -53
- package/CLAUDE.md +0 -111
- package/dist/config.test.d.ts +0 -2
- package/dist/config.test.d.ts.map +0 -1
- package/dist/config.test.js +0 -251
- package/dist/config.test.js.map +0 -1
- package/dist/modules.test.d.ts +0 -2
- package/dist/modules.test.d.ts.map +0 -1
- package/dist/modules.test.js +0 -159
- package/dist/modules.test.js.map +0 -1
- package/dist/queries/utils.test.d.ts +0 -2
- package/dist/queries/utils.test.d.ts.map +0 -1
- package/dist/queries/utils.test.js +0 -117
- package/dist/queries/utils.test.js.map +0 -1
- package/dist/transactions/utils.test.d.ts +0 -2
- package/dist/transactions/utils.test.d.ts.map +0 -1
- package/dist/transactions/utils.test.js +0 -471
- package/dist/transactions/utils.test.js.map +0 -1
- package/src/client.ts +0 -288
- package/src/config.test.ts +0 -299
- package/src/config.ts +0 -174
- package/src/cosmos.ts +0 -106
- package/src/index.ts +0 -478
- package/src/modules.test.ts +0 -189
- package/src/modules.ts +0 -428
- package/src/queries/auth.ts +0 -97
- package/src/queries/bank.ts +0 -99
- package/src/queries/billing.ts +0 -124
- package/src/queries/distribution.ts +0 -114
- package/src/queries/gov.ts +0 -104
- package/src/queries/index.ts +0 -16
- package/src/queries/sku.ts +0 -85
- package/src/queries/staking.ts +0 -154
- package/src/queries/utils.test.ts +0 -156
- package/src/queries/utils.ts +0 -145
- package/src/transactions/bank.ts +0 -86
- package/src/transactions/billing.ts +0 -286
- package/src/transactions/distribution.ts +0 -76
- package/src/transactions/gov.ts +0 -191
- package/src/transactions/index.ts +0 -7
- package/src/transactions/manifest.ts +0 -67
- package/src/transactions/sku.ts +0 -232
- package/src/transactions/staking.ts +0 -85
- package/src/transactions/utils.test.ts +0 -518
- package/src/transactions/utils.ts +0 -348
- package/src/types.ts +0 -497
- package/src/wallet/index.ts +0 -2
- package/src/wallet/mnemonic.ts +0 -146
- package/tsconfig.json +0 -23
package/src/types.ts
DELETED
|
@@ -1,497 +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
|
-
// SKU query results
|
|
409
|
-
export interface SkuParamsResult {
|
|
410
|
-
readonly params?: unknown;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
export interface ProviderResult {
|
|
414
|
-
readonly provider?: unknown;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
export interface ProvidersResult extends PaginatedResult {
|
|
418
|
-
readonly providers: readonly unknown[];
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
export interface SkuResult {
|
|
422
|
-
readonly sku?: unknown;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
export interface SkusResult extends PaginatedResult {
|
|
426
|
-
readonly skus: readonly unknown[];
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* Union type of all query results for type-safe handling
|
|
431
|
-
*/
|
|
432
|
-
export type QueryResult =
|
|
433
|
-
| BalanceResult
|
|
434
|
-
| BalancesResult
|
|
435
|
-
| TotalSupplyResult
|
|
436
|
-
| SupplyOfResult
|
|
437
|
-
| DenomMetadataResult
|
|
438
|
-
| DenomsMetadataResult
|
|
439
|
-
| SendEnabledResult
|
|
440
|
-
| BankParamsResult
|
|
441
|
-
| DelegationResult
|
|
442
|
-
| DelegationsResult
|
|
443
|
-
| UnbondingDelegationResult
|
|
444
|
-
| UnbondingDelegationsResult
|
|
445
|
-
| RedelegationsResult
|
|
446
|
-
| ValidatorResult
|
|
447
|
-
| ValidatorsResult
|
|
448
|
-
| StakingPoolResult
|
|
449
|
-
| StakingParamsResult
|
|
450
|
-
| HistoricalInfoResult
|
|
451
|
-
| RewardsResult
|
|
452
|
-
| CommissionResult
|
|
453
|
-
| CommunityPoolResult
|
|
454
|
-
| DistributionParamsResult
|
|
455
|
-
| ValidatorOutstandingRewardsResult
|
|
456
|
-
| SlashesResult
|
|
457
|
-
| DelegatorValidatorsResult
|
|
458
|
-
| DelegatorWithdrawAddressResult
|
|
459
|
-
| ProposalResult
|
|
460
|
-
| ProposalsResult
|
|
461
|
-
| VoteResult
|
|
462
|
-
| VotesResult
|
|
463
|
-
| DepositResult
|
|
464
|
-
| DepositsResult
|
|
465
|
-
| TallyResult
|
|
466
|
-
| GovParamsResult
|
|
467
|
-
| AuthAccountResult
|
|
468
|
-
| AuthAccountsResult
|
|
469
|
-
| AuthParamsResult
|
|
470
|
-
| ModuleAccountsResult
|
|
471
|
-
| AddressBytesToStringResult
|
|
472
|
-
| AddressStringToBytesResult
|
|
473
|
-
| Bech32PrefixResult
|
|
474
|
-
| AccountInfoResult
|
|
475
|
-
| BillingParamsResult
|
|
476
|
-
| LeaseResult
|
|
477
|
-
| LeasesResult
|
|
478
|
-
| CreditAccountResult
|
|
479
|
-
| CreditAccountsResult
|
|
480
|
-
| CreditAddressResult
|
|
481
|
-
| WithdrawableAmountResult
|
|
482
|
-
| ProviderWithdrawableResult
|
|
483
|
-
| CreditEstimateResult
|
|
484
|
-
| SkuParamsResult
|
|
485
|
-
| ProviderResult
|
|
486
|
-
| ProvidersResult
|
|
487
|
-
| SkuResult
|
|
488
|
-
| SkusResult;
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* Result from a Cosmos query
|
|
492
|
-
*/
|
|
493
|
-
export interface CosmosQueryResult {
|
|
494
|
-
readonly module: string;
|
|
495
|
-
readonly subcommand: string;
|
|
496
|
-
readonly result: QueryResult;
|
|
497
|
-
}
|
package/src/wallet/index.ts
DELETED
package/src/wallet/mnemonic.ts
DELETED
|
@@ -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
|
-
}
|