@manifest-network/manifest-mcp-core 0.4.7 → 0.5.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/dist/cosmos.d.ts +14 -2
- package/dist/cosmos.d.ts.map +1 -1
- package/dist/cosmos.js +65 -2
- package/dist/cosmos.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/modules.d.ts +12 -2
- package/dist/modules.d.ts.map +1 -1
- package/dist/modules.js +28 -10
- package/dist/modules.js.map +1 -1
- package/dist/transactions/bank.d.ts +6 -2
- package/dist/transactions/bank.d.ts.map +1 -1
- package/dist/transactions/bank.js +37 -26
- package/dist/transactions/bank.js.map +1 -1
- package/dist/transactions/billing.d.ts +6 -2
- package/dist/transactions/billing.d.ts.map +1 -1
- package/dist/transactions/billing.js +111 -93
- package/dist/transactions/billing.js.map +1 -1
- package/dist/transactions/distribution.d.ts +6 -2
- package/dist/transactions/distribution.d.ts.map +1 -1
- package/dist/transactions/distribution.js +42 -30
- package/dist/transactions/distribution.js.map +1 -1
- package/dist/transactions/gov.d.ts +6 -2
- package/dist/transactions/gov.d.ts.map +1 -1
- package/dist/transactions/gov.js +47 -35
- package/dist/transactions/gov.js.map +1 -1
- package/dist/transactions/group.d.ts +6 -2
- package/dist/transactions/group.d.ts.map +1 -1
- package/dist/transactions/group.js +159 -136
- package/dist/transactions/group.js.map +1 -1
- package/dist/transactions/index.d.ts +10 -10
- package/dist/transactions/index.js +10 -10
- package/dist/transactions/manifest.d.ts +6 -2
- package/dist/transactions/manifest.d.ts.map +1 -1
- package/dist/transactions/manifest.js +30 -19
- package/dist/transactions/manifest.js.map +1 -1
- package/dist/transactions/sku.d.ts +6 -2
- package/dist/transactions/sku.d.ts.map +1 -1
- package/dist/transactions/sku.js +100 -85
- package/dist/transactions/sku.js.map +1 -1
- package/dist/transactions/staking.d.ts +6 -2
- package/dist/transactions/staking.d.ts.map +1 -1
- package/dist/transactions/staking.js +53 -40
- package/dist/transactions/staking.js.map +1 -1
- package/dist/transactions/wasm.d.ts +7 -3
- package/dist/transactions/wasm.d.ts.map +1 -1
- package/dist/transactions/wasm.js +92 -69
- package/dist/transactions/wasm.js.map +1 -1
- package/dist/types.d.ts +43 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/cosmos.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CosmosQueryResult, CosmosTxResult, TxOverrides } from "./types.js";
|
|
1
|
+
import { CosmosQueryResult, CosmosTxResult, FeeEstimateResult, TxOverrides } from "./types.js";
|
|
2
2
|
import { CosmosClientManager } from "./client.js";
|
|
3
3
|
|
|
4
4
|
//#region src/cosmos.d.ts
|
|
@@ -19,6 +19,18 @@ declare function cosmosQuery(clientManager: CosmosClientManager, module: string,
|
|
|
19
19
|
* (insufficient funds, invalid args, etc.) are not retried as they won't succeed.
|
|
20
20
|
*/
|
|
21
21
|
declare function cosmosTx(clientManager: CosmosClientManager, module: string, subcommand: string, args?: string[], waitForConfirmation?: boolean, overrides?: TxOverrides): Promise<CosmosTxResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Estimate the fee for a Cosmos transaction without broadcasting it.
|
|
24
|
+
*
|
|
25
|
+
* Looks up the message builder for the given module, builds the messages,
|
|
26
|
+
* and calls `client.simulate()` to get a gas estimate. Multiplies by the
|
|
27
|
+
* configured (or overridden) gas multiplier and computes the fee.
|
|
28
|
+
*
|
|
29
|
+
* Automatically retries on transient failures via `withRetry`.
|
|
30
|
+
*
|
|
31
|
+
* @returns FeeEstimateResult with raw gas estimate and computed fee
|
|
32
|
+
*/
|
|
33
|
+
declare function cosmosEstimateFee(clientManager: CosmosClientManager, module: string, subcommand: string, args?: string[], overrides?: TxOverrides): Promise<FeeEstimateResult>;
|
|
22
34
|
//#endregion
|
|
23
|
-
export { cosmosQuery, cosmosTx };
|
|
35
|
+
export { cosmosEstimateFee, cosmosQuery, cosmosTx };
|
|
24
36
|
//# sourceMappingURL=cosmos.d.ts.map
|
package/dist/cosmos.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosmos.d.ts","names":[],"sources":["../src/cosmos.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"cosmos.d.ts","names":[],"sources":["../src/cosmos.ts"],"mappings":";;;;;;AA2CA;;;;iBAAsB,WAAA,CACpB,aAAA,EAAe,mBAAA,EACf,MAAA,UACA,UAAA,UACA,IAAA,cACC,OAAA,CAAQ,iBAAA;;;;;;;;;;iBAoDW,QAAA,CACpB,aAAA,EAAe,mBAAA,EACf,MAAA,UACA,UAAA,UACA,IAAA,aACA,mBAAA,YACA,SAAA,GAAY,WAAA,GACX,OAAA,CAAQ,cAAA;;;AAPX;;;;;;;;;iBA2FsB,iBAAA,CACpB,aAAA,EAAe,mBAAA,EACf,MAAA,UACA,UAAA,UACA,IAAA,aACA,SAAA,GAAY,WAAA,GACX,OAAA,CAAQ,iBAAA"}
|
package/dist/cosmos.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ManifestMCPError, ManifestMCPErrorCode } from "./types.js";
|
|
2
2
|
import { withRetry } from "./retry.js";
|
|
3
|
-
import
|
|
3
|
+
import "./config.js";
|
|
4
|
+
import { getQueryHandler, getTxHandler, getTxMsgBuilder } from "./modules.js";
|
|
5
|
+
import { calculateFee } from "@cosmjs/stargate";
|
|
4
6
|
//#region src/cosmos.ts
|
|
5
7
|
const VALID_NAME_PATTERN = /^[a-zA-Z0-9_][a-zA-Z0-9_-]*$/;
|
|
6
8
|
/**
|
|
@@ -89,7 +91,68 @@ async function cosmosTx(clientManager, module, subcommand, args = [], waitForCon
|
|
|
89
91
|
operationName: `tx ${module} ${subcommand}`
|
|
90
92
|
});
|
|
91
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Estimate the fee for a Cosmos transaction without broadcasting it.
|
|
96
|
+
*
|
|
97
|
+
* Looks up the message builder for the given module, builds the messages,
|
|
98
|
+
* and calls `client.simulate()` to get a gas estimate. Multiplies by the
|
|
99
|
+
* configured (or overridden) gas multiplier and computes the fee.
|
|
100
|
+
*
|
|
101
|
+
* Automatically retries on transient failures via `withRetry`.
|
|
102
|
+
*
|
|
103
|
+
* @returns FeeEstimateResult with raw gas estimate and computed fee
|
|
104
|
+
*/
|
|
105
|
+
async function cosmosEstimateFee(clientManager, module, subcommand, args = [], overrides) {
|
|
106
|
+
validateName(module, "module", ManifestMCPErrorCode.UNSUPPORTED_TX);
|
|
107
|
+
validateName(subcommand, "subcommand", ManifestMCPErrorCode.UNSUPPORTED_TX);
|
|
108
|
+
const config = clientManager.getConfig();
|
|
109
|
+
const gasPrice = config.gasPrice;
|
|
110
|
+
if (!gasPrice) throw new ManifestMCPError(ManifestMCPErrorCode.INVALID_CONFIG, "Fee estimation requires gasPrice configuration");
|
|
111
|
+
if (overrides?.gasMultiplier !== void 0) {
|
|
112
|
+
if (!Number.isFinite(overrides.gasMultiplier) || overrides.gasMultiplier < 1) throw new ManifestMCPError(ManifestMCPErrorCode.INVALID_CONFIG, `gasMultiplier must be a finite number >= 1, got ${overrides.gasMultiplier}`);
|
|
113
|
+
}
|
|
114
|
+
const builder = getTxMsgBuilder(module);
|
|
115
|
+
return withRetry(async () => {
|
|
116
|
+
await clientManager.acquireRateLimit();
|
|
117
|
+
const signingClient = await clientManager.getSigningClient();
|
|
118
|
+
const senderAddress = await clientManager.getAddress();
|
|
119
|
+
const clientMultiplier = signingClient.defaultGasMultiplier;
|
|
120
|
+
const gasMultiplier = overrides?.gasMultiplier ?? (typeof clientMultiplier === "number" ? clientMultiplier : 1.5);
|
|
121
|
+
try {
|
|
122
|
+
const built = builder(senderAddress, subcommand, args);
|
|
123
|
+
const gasEstimate = await signingClient.simulate(senderAddress, built.messages, built.memo);
|
|
124
|
+
const fee = calculateFee(Math.ceil(gasEstimate * gasMultiplier), gasPrice);
|
|
125
|
+
return {
|
|
126
|
+
module,
|
|
127
|
+
subcommand: built.canonicalSubcommand ?? subcommand,
|
|
128
|
+
gasEstimate: String(gasEstimate),
|
|
129
|
+
fee: {
|
|
130
|
+
amount: fee.amount,
|
|
131
|
+
gas: fee.gas
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
} catch (error) {
|
|
135
|
+
if (error instanceof ManifestMCPError) {
|
|
136
|
+
if (!error.details?.module) throw new ManifestMCPError(error.code, error.message, {
|
|
137
|
+
...error.details,
|
|
138
|
+
module,
|
|
139
|
+
subcommand,
|
|
140
|
+
args
|
|
141
|
+
});
|
|
142
|
+
throw error;
|
|
143
|
+
}
|
|
144
|
+
throw new ManifestMCPError(ManifestMCPErrorCode.SIMULATION_FAILED, `Fee estimation for ${module} ${subcommand} failed: ${error instanceof Error ? error.message : String(error)}`, {
|
|
145
|
+
module,
|
|
146
|
+
subcommand,
|
|
147
|
+
args
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}, {
|
|
151
|
+
config: config.retry,
|
|
152
|
+
operationName: `estimate ${module} ${subcommand}`
|
|
153
|
+
});
|
|
154
|
+
}
|
|
92
155
|
//#endregion
|
|
93
|
-
export { cosmosQuery, cosmosTx };
|
|
156
|
+
export { cosmosEstimateFee, cosmosQuery, cosmosTx };
|
|
94
157
|
|
|
95
158
|
//# sourceMappingURL=cosmos.js.map
|
package/dist/cosmos.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosmos.js","names":[],"sources":["../src/cosmos.ts"],"sourcesContent":["import type { CosmosClientManager } from './client.js';\nimport { getQueryHandler, getTxHandler } from './modules.js';\nimport { withRetry } from './retry.js';\nimport {\n type CosmosQueryResult,\n type CosmosTxResult,\n ManifestMCPError,\n ManifestMCPErrorCode,\n type TxOptions,\n type TxOverrides,\n} from './types.js';\n\n// Validation pattern for module/subcommand names (alphanumeric, hyphens, underscores)\n// First character must not be a hyphen to prevent potential issues\nconst VALID_NAME_PATTERN = /^[a-zA-Z0-9_][a-zA-Z0-9_-]*$/;\n\n/**\n * Validate that a string is safe for use as a module or subcommand name.\n * Uses the appropriate UNSUPPORTED_QUERY or UNSUPPORTED_TX code so that\n * the error is immediately classified as non-retryable.\n */\nfunction validateName(\n name: string,\n field: string,\n errorCode: ManifestMCPErrorCode,\n): void {\n if (!name || !VALID_NAME_PATTERN.test(name)) {\n throw new ManifestMCPError(\n errorCode,\n `Invalid ${field}: \"${name}\". Only alphanumeric characters, hyphens, and underscores are allowed.`,\n );\n }\n}\n\n/**\n * Execute a Cosmos query via manifestjs RPC client\n *\n * Automatically retries on transient failures (network errors, timeouts, 5xx)\n * with exponential backoff. Configure retry behavior via `config.retry`.\n */\nexport async function cosmosQuery(\n clientManager: CosmosClientManager,\n module: string,\n subcommand: string,\n args: string[] = [],\n): Promise<CosmosQueryResult> {\n validateName(module, 'module', ManifestMCPErrorCode.UNSUPPORTED_QUERY);\n validateName(\n subcommand,\n 'subcommand',\n ManifestMCPErrorCode.UNSUPPORTED_QUERY,\n );\n\n // Get handler from registry (throws if module not found) - do this before retry loop\n const handler = getQueryHandler(module);\n\n return withRetry(\n async () => {\n // Apply rate limiting before making RPC request\n await clientManager.acquireRateLimit();\n\n const queryClient = await clientManager.getQueryClient();\n\n try {\n const result = await handler(queryClient, subcommand, args);\n\n return {\n module,\n subcommand,\n result,\n };\n } catch (error) {\n if (error instanceof ManifestMCPError) {\n throw error;\n }\n throw new ManifestMCPError(\n ManifestMCPErrorCode.QUERY_FAILED,\n `Query ${module} ${subcommand} failed: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n {\n config: clientManager.getConfig().retry,\n operationName: `query ${module} ${subcommand}`,\n },\n );\n}\n\n/**\n * Execute a Cosmos transaction via manifestjs signing client\n *\n * Automatically retries on transient failures (network errors, timeouts, 5xx)\n * with exponential backoff. Configure retry behavior via `config.retry`.\n *\n * Note: Only network-level failures are retried. Transaction validation errors\n * (insufficient funds, invalid args, etc.) are not retried as they won't succeed.\n */\nexport async function cosmosTx(\n clientManager: CosmosClientManager,\n module: string,\n subcommand: string,\n args: string[] = [],\n waitForConfirmation: boolean = false,\n overrides?: TxOverrides,\n): Promise<CosmosTxResult> {\n validateName(module, 'module', ManifestMCPErrorCode.UNSUPPORTED_TX);\n validateName(subcommand, 'subcommand', ManifestMCPErrorCode.UNSUPPORTED_TX);\n\n // Build fully-resolved gas options from caller overrides + server config\n let txOptions: TxOptions | undefined;\n if (overrides?.gasMultiplier !== undefined) {\n if (\n !Number.isFinite(overrides.gasMultiplier) ||\n overrides.gasMultiplier < 1\n ) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.INVALID_CONFIG,\n `gasMultiplier must be a finite number >= 1, got ${overrides.gasMultiplier}`,\n );\n }\n const gasPrice = clientManager.getConfig().gasPrice;\n if (!gasPrice) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.INVALID_CONFIG,\n 'gasMultiplier override requires gasPrice configuration',\n );\n }\n txOptions = { gasMultiplier: overrides.gasMultiplier, gasPrice };\n }\n\n // Get handler from registry (throws if module not found) - do this before retry loop\n const handler = getTxHandler(module);\n\n return withRetry(\n async () => {\n // Apply rate limiting before making RPC request\n await clientManager.acquireRateLimit();\n\n const signingClient = await clientManager.getSigningClient();\n const senderAddress = await clientManager.getAddress();\n\n try {\n return await handler(\n signingClient,\n senderAddress,\n subcommand,\n args,\n waitForConfirmation,\n txOptions,\n );\n } catch (error) {\n if (error instanceof ManifestMCPError) {\n // Re-throw with enriched context if not already present\n if (!error.details?.module) {\n throw new ManifestMCPError(error.code, error.message, {\n ...error.details,\n module,\n subcommand,\n args,\n });\n }\n throw error;\n }\n throw new ManifestMCPError(\n ManifestMCPErrorCode.TX_FAILED,\n `Tx ${module} ${subcommand} failed: ${error instanceof Error ? error.message : String(error)}`,\n { module, subcommand, args },\n );\n }\n },\n {\n config: clientManager.getConfig().retry,\n operationName: `tx ${module} ${subcommand}`,\n },\n );\n}\n"],"mappings":";;;;AAcA,MAAM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MAAM,UAAU,aAAa,OAAO;AAEpC,QAAO,UACL,YAAY;AAEV,QAAM,cAAc,kBAAkB;EAEtC,MAAM,gBAAgB,MAAM,cAAc,kBAAkB;EAC5D,MAAM,gBAAgB,MAAM,cAAc,YAAY;AAEtD,MAAI;AACF,UAAO,MAAM,QACX,eACA,eACA,YACA,MACA,qBACA,UACD;WACM,OAAO;AACd,OAAI,iBAAiB,kBAAkB;AAErC,QAAI,CAAC,MAAM,SAAS,OAClB,OAAM,IAAI,iBAAiB,MAAM,MAAM,MAAM,SAAS;KACpD,GAAG,MAAM;KACT;KACA;KACA;KACD,CAAC;AAEJ,UAAM;;AAER,SAAM,IAAI,iBACR,qBAAqB,WACrB,MAAM,OAAO,GAAG,WAAW,WAAW,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,IAC5F;IAAE;IAAQ;IAAY;IAAM,CAC7B;;IAGL;EACE,QAAQ,cAAc,WAAW,CAAC;EAClC,eAAe,MAAM,OAAO,GAAG;EAChC,CACF"}
|
|
1
|
+
{"version":3,"file":"cosmos.js","names":[],"sources":["../src/cosmos.ts"],"sourcesContent":["import { calculateFee } from '@cosmjs/stargate';\nimport type { CosmosClientManager } from './client.js';\nimport { DEFAULT_GAS_MULTIPLIER } from './config.js';\nimport { getQueryHandler, getTxHandler, getTxMsgBuilder } from './modules.js';\nimport { withRetry } from './retry.js';\nimport {\n type CosmosQueryResult,\n type CosmosTxResult,\n type FeeEstimateResult,\n ManifestMCPError,\n ManifestMCPErrorCode,\n type TxOptions,\n type TxOverrides,\n} from './types.js';\n\n// Validation pattern for module/subcommand names (alphanumeric, hyphens, underscores)\n// First character must not be a hyphen to prevent potential issues\nconst VALID_NAME_PATTERN = /^[a-zA-Z0-9_][a-zA-Z0-9_-]*$/;\n\n/**\n * Validate that a string is safe for use as a module or subcommand name.\n * Uses the appropriate UNSUPPORTED_QUERY or UNSUPPORTED_TX code so that\n * the error is immediately classified as non-retryable.\n */\nfunction validateName(\n name: string,\n field: string,\n errorCode: ManifestMCPErrorCode,\n): void {\n if (!name || !VALID_NAME_PATTERN.test(name)) {\n throw new ManifestMCPError(\n errorCode,\n `Invalid ${field}: \"${name}\". Only alphanumeric characters, hyphens, and underscores are allowed.`,\n );\n }\n}\n\n/**\n * Execute a Cosmos query via manifestjs RPC client\n *\n * Automatically retries on transient failures (network errors, timeouts, 5xx)\n * with exponential backoff. Configure retry behavior via `config.retry`.\n */\nexport async function cosmosQuery(\n clientManager: CosmosClientManager,\n module: string,\n subcommand: string,\n args: string[] = [],\n): Promise<CosmosQueryResult> {\n validateName(module, 'module', ManifestMCPErrorCode.UNSUPPORTED_QUERY);\n validateName(\n subcommand,\n 'subcommand',\n ManifestMCPErrorCode.UNSUPPORTED_QUERY,\n );\n\n // Get handler from registry (throws if module not found) - do this before retry loop\n const handler = getQueryHandler(module);\n\n return withRetry(\n async () => {\n // Apply rate limiting before making RPC request\n await clientManager.acquireRateLimit();\n\n const queryClient = await clientManager.getQueryClient();\n\n try {\n const result = await handler(queryClient, subcommand, args);\n\n return {\n module,\n subcommand,\n result,\n };\n } catch (error) {\n if (error instanceof ManifestMCPError) {\n throw error;\n }\n throw new ManifestMCPError(\n ManifestMCPErrorCode.QUERY_FAILED,\n `Query ${module} ${subcommand} failed: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n {\n config: clientManager.getConfig().retry,\n operationName: `query ${module} ${subcommand}`,\n },\n );\n}\n\n/**\n * Execute a Cosmos transaction via manifestjs signing client\n *\n * Automatically retries on transient failures (network errors, timeouts, 5xx)\n * with exponential backoff. Configure retry behavior via `config.retry`.\n *\n * Note: Only network-level failures are retried. Transaction validation errors\n * (insufficient funds, invalid args, etc.) are not retried as they won't succeed.\n */\nexport async function cosmosTx(\n clientManager: CosmosClientManager,\n module: string,\n subcommand: string,\n args: string[] = [],\n waitForConfirmation: boolean = false,\n overrides?: TxOverrides,\n): Promise<CosmosTxResult> {\n validateName(module, 'module', ManifestMCPErrorCode.UNSUPPORTED_TX);\n validateName(subcommand, 'subcommand', ManifestMCPErrorCode.UNSUPPORTED_TX);\n\n // Build fully-resolved gas options from caller overrides + server config\n let txOptions: TxOptions | undefined;\n if (overrides?.gasMultiplier !== undefined) {\n if (\n !Number.isFinite(overrides.gasMultiplier) ||\n overrides.gasMultiplier < 1\n ) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.INVALID_CONFIG,\n `gasMultiplier must be a finite number >= 1, got ${overrides.gasMultiplier}`,\n );\n }\n const gasPrice = clientManager.getConfig().gasPrice;\n if (!gasPrice) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.INVALID_CONFIG,\n 'gasMultiplier override requires gasPrice configuration',\n );\n }\n txOptions = { gasMultiplier: overrides.gasMultiplier, gasPrice };\n }\n\n // Get handler from registry (throws if module not found) - do this before retry loop\n const handler = getTxHandler(module);\n\n return withRetry(\n async () => {\n // Apply rate limiting before making RPC request\n await clientManager.acquireRateLimit();\n\n const signingClient = await clientManager.getSigningClient();\n const senderAddress = await clientManager.getAddress();\n\n try {\n return await handler(\n signingClient,\n senderAddress,\n subcommand,\n args,\n waitForConfirmation,\n txOptions,\n );\n } catch (error) {\n if (error instanceof ManifestMCPError) {\n // Re-throw with enriched context if not already present\n if (!error.details?.module) {\n throw new ManifestMCPError(error.code, error.message, {\n ...error.details,\n module,\n subcommand,\n args,\n });\n }\n throw error;\n }\n throw new ManifestMCPError(\n ManifestMCPErrorCode.TX_FAILED,\n `Tx ${module} ${subcommand} failed: ${error instanceof Error ? error.message : String(error)}`,\n { module, subcommand, args },\n );\n }\n },\n {\n config: clientManager.getConfig().retry,\n operationName: `tx ${module} ${subcommand}`,\n },\n );\n}\n\n/**\n * Estimate the fee for a Cosmos transaction without broadcasting it.\n *\n * Looks up the message builder for the given module, builds the messages,\n * and calls `client.simulate()` to get a gas estimate. Multiplies by the\n * configured (or overridden) gas multiplier and computes the fee.\n *\n * Automatically retries on transient failures via `withRetry`.\n *\n * @returns FeeEstimateResult with raw gas estimate and computed fee\n */\nexport async function cosmosEstimateFee(\n clientManager: CosmosClientManager,\n module: string,\n subcommand: string,\n args: string[] = [],\n overrides?: TxOverrides,\n): Promise<FeeEstimateResult> {\n validateName(module, 'module', ManifestMCPErrorCode.UNSUPPORTED_TX);\n validateName(subcommand, 'subcommand', ManifestMCPErrorCode.UNSUPPORTED_TX);\n\n // Always need gasPrice for fee calculation (unlike cosmosTx which can use 'auto')\n const config = clientManager.getConfig();\n const gasPrice = config.gasPrice;\n if (!gasPrice) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.INVALID_CONFIG,\n 'Fee estimation requires gasPrice configuration',\n );\n }\n\n // Validate the override eagerly (the resolved fallback values are always valid).\n if (overrides?.gasMultiplier !== undefined) {\n if (\n !Number.isFinite(overrides.gasMultiplier) ||\n overrides.gasMultiplier < 1\n ) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.INVALID_CONFIG,\n `gasMultiplier must be a finite number >= 1, got ${overrides.gasMultiplier}`,\n );\n }\n }\n\n // Get builder from registry (throws if module not found) - do this before retry loop\n const builder = getTxMsgBuilder(module);\n\n return withRetry(\n async () => {\n // Apply rate limiting before making RPC request\n await clientManager.acquireRateLimit();\n\n const signingClient = await clientManager.getSigningClient();\n const senderAddress = await clientManager.getAddress();\n\n // Resolve gasMultiplier from the signing client when no override is provided.\n // This guarantees parity with cosmosTx's 'auto' path: client.ts patches the\n // signing client's defaultGasMultiplier to config.gasMultiplier; if that\n // patch fails (rare — only when CosmJS internals change), the client\n // falls back to CosmJS's built-in default. Reading from the client uses\n // the same value cosmosTx would.\n const clientMultiplier = (\n signingClient as unknown as { defaultGasMultiplier?: unknown }\n ).defaultGasMultiplier;\n const gasMultiplier =\n overrides?.gasMultiplier ??\n (typeof clientMultiplier === 'number'\n ? clientMultiplier\n : DEFAULT_GAS_MULTIPLIER);\n\n try {\n const built = builder(senderAddress, subcommand, args);\n const gasEstimate = await signingClient.simulate(\n senderAddress,\n built.messages,\n built.memo,\n );\n const gasLimit = Math.ceil(gasEstimate * gasMultiplier);\n const fee = calculateFee(gasLimit, gasPrice);\n\n return {\n module,\n subcommand: built.canonicalSubcommand ?? subcommand,\n gasEstimate: String(gasEstimate),\n fee: { amount: fee.amount, gas: fee.gas },\n };\n } catch (error) {\n if (error instanceof ManifestMCPError) {\n // Re-throw with enriched context if not already present (mirrors cosmosTx)\n if (!error.details?.module) {\n throw new ManifestMCPError(error.code, error.message, {\n ...error.details,\n module,\n subcommand,\n args,\n });\n }\n throw error;\n }\n // SIMULATION_FAILED is NOT in NON_RETRYABLE_ERROR_CODES, so withRetry\n // will fall through to isTransientErrorMessage for message-based\n // classification. Transient errors (network/5xx) get retried; real\n // simulation failures (insufficient funds, etc) fail fast.\n throw new ManifestMCPError(\n ManifestMCPErrorCode.SIMULATION_FAILED,\n `Fee estimation for ${module} ${subcommand} failed: ${error instanceof Error ? error.message : String(error)}`,\n { module, subcommand, args },\n );\n }\n },\n {\n config: config.retry,\n operationName: `estimate ${module} ${subcommand}`,\n },\n );\n}\n"],"mappings":";;;;;;AAiBA,MAAM,qBAAqB;;;;;;AAO3B,SAAS,aACP,MACA,OACA,WACM;AACN,KAAI,CAAC,QAAQ,CAAC,mBAAmB,KAAK,KAAK,CACzC,OAAM,IAAI,iBACR,WACA,WAAW,MAAM,KAAK,KAAK,wEAC5B;;;;;;;;AAUL,eAAsB,YACpB,eACA,QACA,YACA,OAAiB,EAAE,EACS;AAC5B,cAAa,QAAQ,UAAU,qBAAqB,kBAAkB;AACtE,cACE,YACA,cACA,qBAAqB,kBACtB;CAGD,MAAM,UAAU,gBAAgB,OAAO;AAEvC,QAAO,UACL,YAAY;AAEV,QAAM,cAAc,kBAAkB;EAEtC,MAAM,cAAc,MAAM,cAAc,gBAAgB;AAExD,MAAI;AAGF,UAAO;IACL;IACA;IACA,QALa,MAAM,QAAQ,aAAa,YAAY,KAAK;IAM1D;WACM,OAAO;AACd,OAAI,iBAAiB,iBACnB,OAAM;AAER,SAAM,IAAI,iBACR,qBAAqB,cACr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,mBACrB,sBAAsB,OAAO,GAAG,WAAW,WAAW,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,IAC5G;IAAE;IAAQ;IAAY;IAAM,CAC7B;;IAGL;EACE,QAAQ,OAAO;EACf,eAAe,YAAY,OAAO,GAAG;EACtC,CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AccountInfo, AccountInfoResult, AddressBytesToStringResult, AddressStringToBytesResult, Any, AuthAccountResult, AuthAccountsResult, AuthParams, AuthParamsResult, AvailableModules, BalanceResult, BalancesResult, BankMetadata, BankParams, BankParamsResult, BaseAccount, Bech32PrefixResult, BillingParams, BillingParamsResult, CodeInfoResponse, Coin, CommissionResult, CommunityPoolResult, ContractCodeHistoryEntry, ContractInfo, CosmosQueryResult, CosmosTxResult, CreditAccount, CreditAccountResult, CreditAccountsResult, CreditAddressResult, CreditEstimateResult, DecCoin, DelegationDelegatorReward, DelegationResponse, DelegationResult, DelegationsResult, DelegatorValidatorsResult, DelegatorWithdrawAddressResult, DenomMetadataResult, DenomsMetadataResult, DepositParams, DepositResult, DepositsResult, DistributionParams, DistributionParamsResult, GovDeposit, GovParams, GovParamsResult, GovProposal, GovTallyResult, GovVote, GroupInfo, GroupInfoResult, GroupMember, GroupMembersResult, GroupPoliciesResult, GroupPolicyInfo, GroupPolicyInfoResult, GroupProposal, GroupProposalResult, GroupProposalsResult, GroupTallyQueryResult, GroupTallyResult, GroupVote, GroupVoteResult, GroupVotesResult, GroupsResult, HistoricalInfo, HistoricalInfoResult, Lease, LeaseItemInput, LeaseResult, LeasesResult, ManifestMCPConfig, ManifestMCPError, ManifestMCPErrorCode, Model, ModuleAccount, ModuleAccountsResult, ModuleInfo, PaginatedResult, PaginationResponse, ProposalResult, ProposalsResult, Provider, ProviderResult, ProviderWithdrawableResult, ProvidersResult, QueryCreditEstimateResponse, QueryResult, RateLimitConfig, RedelegationResponse, RedelegationsResult, RetryConfig, RewardsResult, SKU, SendEnabled, SendEnabledResult, SignArbitraryResult, SkuParams, SkuParamsResult, SkuResult, SkusResult, SlashesResult, StakingParams, StakingParamsResult, StakingPool, StakingPoolResult, SupplyOfResult, TallyParams, TallyResult, TotalSupplyResult, TxOptions, TxOverrides, UnbondingDelegation, UnbondingDelegationResult, UnbondingDelegationsResult, Validator, ValidatorAccumulatedCommission, ValidatorOutstandingRewards, ValidatorOutstandingRewardsResult, ValidatorResult, ValidatorSlashEvent, ValidatorsResult, VoteResult, VotesResult, VotingParams, WalletProvider, WasmAllContractStateResult, WasmBuildAddressResult, WasmCodeInfo, WasmCodeInfoResult, WasmCodeResult, WasmCodesResult, WasmContractHistoryResult, WasmContractInfoResult, WasmContractsByCodeResult, WasmContractsByCreatorResult, WasmLimitsConfigResult, WasmParams, WasmParamsResult, WasmPinnedCodesResult, WasmRawContractStateResult, WasmSmartContractStateResult, WithdrawableAmountResult } from "./types.js";
|
|
1
|
+
import { AccountInfo, AccountInfoResult, AddressBytesToStringResult, AddressStringToBytesResult, Any, AuthAccountResult, AuthAccountsResult, AuthParams, AuthParamsResult, AvailableModules, BalanceResult, BalancesResult, BankMetadata, BankParams, BankParamsResult, BaseAccount, Bech32PrefixResult, BillingParams, BillingParamsResult, BuiltMessages, CodeInfoResponse, Coin, CommissionResult, CommunityPoolResult, ContractCodeHistoryEntry, ContractInfo, CosmosQueryResult, CosmosTxResult, CreditAccount, CreditAccountResult, CreditAccountsResult, CreditAddressResult, CreditEstimateResult, DecCoin, DelegationDelegatorReward, DelegationResponse, DelegationResult, DelegationsResult, DelegatorValidatorsResult, DelegatorWithdrawAddressResult, DenomMetadataResult, DenomsMetadataResult, DepositParams, DepositResult, DepositsResult, DistributionParams, DistributionParamsResult, FeeEstimateResult, GovDeposit, GovParams, GovParamsResult, GovProposal, GovTallyResult, GovVote, GroupInfo, GroupInfoResult, GroupMember, GroupMembersResult, GroupPoliciesResult, GroupPolicyInfo, GroupPolicyInfoResult, GroupProposal, GroupProposalResult, GroupProposalsResult, GroupTallyQueryResult, GroupTallyResult, GroupVote, GroupVoteResult, GroupVotesResult, GroupsResult, HistoricalInfo, HistoricalInfoResult, Lease, LeaseItemInput, LeaseResult, LeasesResult, ManifestMCPConfig, ManifestMCPError, ManifestMCPErrorCode, Model, ModuleAccount, ModuleAccountsResult, ModuleInfo, PaginatedResult, PaginationResponse, ProposalResult, ProposalsResult, Provider, ProviderResult, ProviderWithdrawableResult, ProvidersResult, QueryCreditEstimateResponse, QueryResult, RateLimitConfig, RedelegationResponse, RedelegationsResult, RetryConfig, RewardsResult, SKU, SendEnabled, SendEnabledResult, SignArbitraryResult, SkuParams, SkuParamsResult, SkuResult, SkusResult, SlashesResult, StakingParams, StakingParamsResult, StakingPool, StakingPoolResult, SupplyOfResult, TallyParams, TallyResult, TotalSupplyResult, TxOptions, TxOverrides, UnbondingDelegation, UnbondingDelegationResult, UnbondingDelegationsResult, Validator, ValidatorAccumulatedCommission, ValidatorOutstandingRewards, ValidatorOutstandingRewardsResult, ValidatorResult, ValidatorSlashEvent, ValidatorsResult, VoteResult, VotesResult, VotingParams, WalletProvider, WasmAllContractStateResult, WasmBuildAddressResult, WasmCodeInfo, WasmCodeInfoResult, WasmCodeResult, WasmCodesResult, WasmContractHistoryResult, WasmContractInfoResult, WasmContractsByCodeResult, WasmContractsByCreatorResult, WasmLimitsConfigResult, WasmParams, WasmParamsResult, WasmPinnedCodesResult, WasmRawContractStateResult, WasmSmartContractStateResult, WithdrawableAmountResult } from "./types.js";
|
|
2
2
|
import { CosmosClientManager, ManifestQueryClient } from "./client.js";
|
|
3
3
|
import { DEFAULT_RETRY_CONFIG, RetryOptions, calculateBackoff, isRetryableError, withRetry } from "./retry.js";
|
|
4
4
|
import { ValidationResult, createConfig, createValidatedConfig, validateConfig } from "./config.js";
|
|
5
|
-
import { cosmosQuery, cosmosTx } from "./cosmos.js";
|
|
5
|
+
import { cosmosEstimateFee, cosmosQuery, cosmosTx } from "./cosmos.js";
|
|
6
6
|
import { createLCDQueryClient } from "./lcd-adapter.js";
|
|
7
7
|
import { LogLevel, logger } from "./logger.js";
|
|
8
8
|
import { getAvailableModules, getModuleSubcommands, getSubcommandUsage, getSupportedModules, isSubcommandSupported } from "./modules.js";
|
|
@@ -16,4 +16,4 @@ import { VERSION } from "./version.js";
|
|
|
16
16
|
import { MnemonicWalletProvider } from "./wallet/mnemonic.js";
|
|
17
17
|
import { signArbitraryWithAmino } from "./wallet/sign-arbitrary.js";
|
|
18
18
|
import { LeaseState, leaseStateFromJSON, leaseStateToJSON } from "@manifest-network/manifestjs/dist/codegen/liftedinit/billing/v1/types.js";
|
|
19
|
-
export { AccountInfo, AccountInfoResult, AddressBytesToStringResult, AddressStringToBytesResult, Any, AuthAccountResult, AuthAccountsResult, AuthParams, AuthParamsResult, AvailableModules, BalanceResult, BalancesResult, BankMetadata, BankParams, BankParamsResult, BaseAccount, Bech32PrefixResult, BillingParams, BillingParamsResult, CodeInfoResponse, Coin, CommissionResult, CommunityPoolResult, ContractCodeHistoryEntry, ContractInfo, CosmosClientManager, CosmosQueryResult, CosmosTxResult, CreditAccount, CreditAccountResult, CreditAccountsResult, CreditAddressResult, CreditEstimateResult, DEFAULT_RETRY_CONFIG, DNS_LABEL_RE, DecCoin, DelegationDelegatorReward, DelegationResponse, DelegationResult, DelegationsResult, DelegatorValidatorsResult, DelegatorWithdrawAddressResult, DenomMetadataResult, DenomsMetadataResult, DepositParams, DepositResult, DepositsResult, DistributionParams, DistributionParamsResult, GovDeposit, GovParams, GovParamsResult, GovProposal, GovTallyResult, GovVote, GroupInfo, GroupInfoResult, GroupMember, GroupMembersResult, GroupPoliciesResult, GroupPolicyInfo, GroupPolicyInfoResult, GroupProposal, GroupProposalResult, GroupProposalsResult, GroupTallyQueryResult, GroupTallyResult, GroupVote, GroupVoteResult, GroupVotesResult, GroupsResult, HistoricalInfo, HistoricalInfoResult, INFRASTRUCTURE_ERROR_CODES, Lease, LeaseItemInput, LeaseResult, LeaseState, LeasesResult, type LogLevel, MAX_PAGE_LIMIT, ManifestMCPConfig, ManifestMCPError, ManifestMCPErrorCode, type ManifestMCPServerOptions, type ManifestQueryClient, type MnemonicServerConfig, MnemonicWalletProvider, Model, ModuleAccount, ModuleAccountsResult, ModuleInfo, PaginatedResult, PaginationResponse, ProposalResult, ProposalsResult, Provider, ProviderResult, ProviderWithdrawableResult, ProvidersResult, QueryCreditEstimateResponse, QueryResult, RateLimitConfig, RedelegationResponse, RedelegationsResult, RetryConfig, type RetryOptions, RewardsResult, SENSITIVE_FIELDS, SKU, SendEnabled, SendEnabledResult, SignArbitraryResult, SkuParams, SkuParamsResult, SkuResult, SkusResult, SlashesResult, StakingParams, StakingParamsResult, StakingPool, StakingPoolResult, type StopAppResult, SupplyOfResult, TallyParams, TallyResult, TotalSupplyResult, TxOptions, TxOverrides, UnbondingDelegation, UnbondingDelegationResult, UnbondingDelegationsResult, VERSION, type ValidationResult, Validator, ValidatorAccumulatedCommission, ValidatorOutstandingRewards, ValidatorOutstandingRewardsResult, ValidatorResult, ValidatorSlashEvent, ValidatorsResult, VoteResult, VotesResult, VotingParams, WalletProvider, WasmAllContractStateResult, WasmBuildAddressResult, WasmCodeInfo, WasmCodeInfoResult, WasmCodeResult, WasmCodesResult, WasmContractHistoryResult, WasmContractInfoResult, WasmContractsByCodeResult, WasmContractsByCreatorResult, WasmLimitsConfigResult, WasmParams, WasmParamsResult, WasmPinnedCodesResult, WasmRawContractStateResult, WasmSmartContractStateResult, WithdrawableAmountResult, bigIntReplacer, calculateBackoff, cosmosQuery, cosmosTx, createConfig, createLCDQueryClient, createMnemonicServer, createPagination, createValidatedConfig, fundCredits, getAvailableModules, getBalance, getModuleSubcommands, getSubcommandUsage, getSupportedModules, isRetryableError, isSubcommandSupported, jsonResponse, leaseStateFromJSON, leaseStateToJSON, logger, optionalBoolean, parseArgs, requireString, requireStringEnum, requireUuid, sanitizeForLogging, signArbitraryWithAmino, stopApp, validateConfig, withErrorHandling, withRetry };
|
|
19
|
+
export { AccountInfo, AccountInfoResult, AddressBytesToStringResult, AddressStringToBytesResult, Any, AuthAccountResult, AuthAccountsResult, AuthParams, AuthParamsResult, AvailableModules, BalanceResult, BalancesResult, BankMetadata, BankParams, BankParamsResult, BaseAccount, Bech32PrefixResult, BillingParams, BillingParamsResult, BuiltMessages, CodeInfoResponse, Coin, CommissionResult, CommunityPoolResult, ContractCodeHistoryEntry, ContractInfo, CosmosClientManager, CosmosQueryResult, CosmosTxResult, CreditAccount, CreditAccountResult, CreditAccountsResult, CreditAddressResult, CreditEstimateResult, DEFAULT_RETRY_CONFIG, DNS_LABEL_RE, DecCoin, DelegationDelegatorReward, DelegationResponse, DelegationResult, DelegationsResult, DelegatorValidatorsResult, DelegatorWithdrawAddressResult, DenomMetadataResult, DenomsMetadataResult, DepositParams, DepositResult, DepositsResult, DistributionParams, DistributionParamsResult, FeeEstimateResult, GovDeposit, GovParams, GovParamsResult, GovProposal, GovTallyResult, GovVote, GroupInfo, GroupInfoResult, GroupMember, GroupMembersResult, GroupPoliciesResult, GroupPolicyInfo, GroupPolicyInfoResult, GroupProposal, GroupProposalResult, GroupProposalsResult, GroupTallyQueryResult, GroupTallyResult, GroupVote, GroupVoteResult, GroupVotesResult, GroupsResult, HistoricalInfo, HistoricalInfoResult, INFRASTRUCTURE_ERROR_CODES, Lease, LeaseItemInput, LeaseResult, LeaseState, LeasesResult, type LogLevel, MAX_PAGE_LIMIT, ManifestMCPConfig, ManifestMCPError, ManifestMCPErrorCode, type ManifestMCPServerOptions, type ManifestQueryClient, type MnemonicServerConfig, MnemonicWalletProvider, Model, ModuleAccount, ModuleAccountsResult, ModuleInfo, PaginatedResult, PaginationResponse, ProposalResult, ProposalsResult, Provider, ProviderResult, ProviderWithdrawableResult, ProvidersResult, QueryCreditEstimateResponse, QueryResult, RateLimitConfig, RedelegationResponse, RedelegationsResult, RetryConfig, type RetryOptions, RewardsResult, SENSITIVE_FIELDS, SKU, SendEnabled, SendEnabledResult, SignArbitraryResult, SkuParams, SkuParamsResult, SkuResult, SkusResult, SlashesResult, StakingParams, StakingParamsResult, StakingPool, StakingPoolResult, type StopAppResult, SupplyOfResult, TallyParams, TallyResult, TotalSupplyResult, TxOptions, TxOverrides, UnbondingDelegation, UnbondingDelegationResult, UnbondingDelegationsResult, VERSION, type ValidationResult, Validator, ValidatorAccumulatedCommission, ValidatorOutstandingRewards, ValidatorOutstandingRewardsResult, ValidatorResult, ValidatorSlashEvent, ValidatorsResult, VoteResult, VotesResult, VotingParams, WalletProvider, WasmAllContractStateResult, WasmBuildAddressResult, WasmCodeInfo, WasmCodeInfoResult, WasmCodeResult, WasmCodesResult, WasmContractHistoryResult, WasmContractInfoResult, WasmContractsByCodeResult, WasmContractsByCreatorResult, WasmLimitsConfigResult, WasmParams, WasmParamsResult, WasmPinnedCodesResult, WasmRawContractStateResult, WasmSmartContractStateResult, WithdrawableAmountResult, bigIntReplacer, calculateBackoff, cosmosEstimateFee, cosmosQuery, cosmosTx, createConfig, createLCDQueryClient, createMnemonicServer, createPagination, createValidatedConfig, fundCredits, getAvailableModules, getBalance, getModuleSubcommands, getSubcommandUsage, getSupportedModules, isRetryableError, isSubcommandSupported, jsonResponse, leaseStateFromJSON, leaseStateToJSON, logger, optionalBoolean, parseArgs, requireString, requireStringEnum, requireUuid, sanitizeForLogging, signArbitraryWithAmino, stopApp, validateConfig, withErrorHandling, withRetry };
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { CosmosClientManager } from "./client.js";
|
|
|
7
7
|
import { DNS_LABEL_RE, optionalBoolean, parseArgs, requireString, requireStringEnum, requireUuid } from "./validation.js";
|
|
8
8
|
import { MAX_PAGE_LIMIT, createPagination } from "./queries/utils.js";
|
|
9
9
|
import { getAvailableModules, getModuleSubcommands, getSubcommandUsage, getSupportedModules, isSubcommandSupported } from "./modules.js";
|
|
10
|
-
import { cosmosQuery, cosmosTx } from "./cosmos.js";
|
|
10
|
+
import { cosmosEstimateFee, cosmosQuery, cosmosTx } from "./cosmos.js";
|
|
11
11
|
import { signArbitraryWithAmino } from "./wallet/sign-arbitrary.js";
|
|
12
12
|
import { MnemonicWalletProvider } from "./wallet/mnemonic.js";
|
|
13
13
|
import "./wallet/index.js";
|
|
@@ -17,4 +17,4 @@ import { getBalance } from "./tools/getBalance.js";
|
|
|
17
17
|
import { stopApp } from "./tools/stopApp.js";
|
|
18
18
|
import { VERSION } from "./version.js";
|
|
19
19
|
import { LeaseState, leaseStateFromJSON, leaseStateToJSON } from "@manifest-network/manifestjs/dist/codegen/liftedinit/billing/v1/types.js";
|
|
20
|
-
export { CosmosClientManager, DEFAULT_RETRY_CONFIG, DNS_LABEL_RE, INFRASTRUCTURE_ERROR_CODES, LeaseState, MAX_PAGE_LIMIT, ManifestMCPError, ManifestMCPErrorCode, MnemonicWalletProvider, SENSITIVE_FIELDS, VERSION, bigIntReplacer, calculateBackoff, cosmosQuery, cosmosTx, createConfig, createLCDQueryClient, createMnemonicServer, createPagination, createValidatedConfig, fundCredits, getAvailableModules, getBalance, getModuleSubcommands, getSubcommandUsage, getSupportedModules, isRetryableError, isSubcommandSupported, jsonResponse, leaseStateFromJSON, leaseStateToJSON, logger, optionalBoolean, parseArgs, requireString, requireStringEnum, requireUuid, sanitizeForLogging, signArbitraryWithAmino, stopApp, validateConfig, withErrorHandling, withRetry };
|
|
20
|
+
export { CosmosClientManager, DEFAULT_RETRY_CONFIG, DNS_LABEL_RE, INFRASTRUCTURE_ERROR_CODES, LeaseState, MAX_PAGE_LIMIT, ManifestMCPError, ManifestMCPErrorCode, MnemonicWalletProvider, SENSITIVE_FIELDS, VERSION, bigIntReplacer, calculateBackoff, cosmosEstimateFee, cosmosQuery, cosmosTx, createConfig, createLCDQueryClient, createMnemonicServer, createPagination, createValidatedConfig, fundCredits, getAvailableModules, getBalance, getModuleSubcommands, getSubcommandUsage, getSupportedModules, isRetryableError, isSubcommandSupported, jsonResponse, leaseStateFromJSON, leaseStateToJSON, logger, optionalBoolean, parseArgs, requireString, requireStringEnum, requireUuid, sanitizeForLogging, signArbitraryWithAmino, stopApp, validateConfig, withErrorHandling, withRetry };
|
package/dist/modules.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AvailableModules, CosmosTxResult, ModuleInfo, QueryResult, TxOptions } from "./types.js";
|
|
1
|
+
import { AvailableModules, BuiltMessages, CosmosTxResult, ModuleInfo, QueryResult, TxOptions } from "./types.js";
|
|
2
2
|
import { ManifestQueryClient } from "./client.js";
|
|
3
3
|
import { SigningStargateClient } from "@cosmjs/stargate";
|
|
4
4
|
|
|
@@ -11,6 +11,11 @@ type QueryHandler = (queryClient: ManifestQueryClient, subcommand: string, args:
|
|
|
11
11
|
* Handler function type for transaction modules
|
|
12
12
|
*/
|
|
13
13
|
type TxHandler = (signingClient: SigningStargateClient, senderAddress: string, subcommand: string, args: string[], waitForConfirmation: boolean, options?: TxOptions) => Promise<CosmosTxResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Pure synchronous function type for building transaction messages.
|
|
16
|
+
* Used by `cosmosEstimateFee` to obtain `EncodeObject[]` without signing/broadcasting.
|
|
17
|
+
*/
|
|
18
|
+
type TxMsgBuilder = (senderAddress: string, subcommand: string, args: string[]) => BuiltMessages;
|
|
14
19
|
/**
|
|
15
20
|
* Throw an error for an unsupported subcommand.
|
|
16
21
|
* Automatically looks up available subcommands from the module registry.
|
|
@@ -58,6 +63,11 @@ declare function getQueryHandler(module: string): QueryHandler;
|
|
|
58
63
|
* @throws ManifestMCPError if module is not found
|
|
59
64
|
*/
|
|
60
65
|
declare function getTxHandler(module: string): TxHandler;
|
|
66
|
+
/**
|
|
67
|
+
* Get the message builder function for a transaction module
|
|
68
|
+
* @throws ManifestMCPError if module is not found
|
|
69
|
+
*/
|
|
70
|
+
declare function getTxMsgBuilder(module: string): TxMsgBuilder;
|
|
61
71
|
//#endregion
|
|
62
|
-
export { QueryHandler, TxHandler, getAvailableModules, getModuleSubcommands, getQueryHandler, getSubcommandUsage, getSupportedModules, getTxHandler, isSubcommandSupported, throwUnsupportedSubcommand };
|
|
72
|
+
export { QueryHandler, TxHandler, TxMsgBuilder, getAvailableModules, getModuleSubcommands, getQueryHandler, getSubcommandUsage, getSupportedModules, getTxHandler, getTxMsgBuilder, isSubcommandSupported, throwUnsupportedSubcommand };
|
|
63
73
|
//# sourceMappingURL=modules.d.ts.map
|
package/dist/modules.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.d.ts","names":[],"sources":["../src/modules.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"modules.d.ts","names":[],"sources":["../src/modules.ts"],"mappings":";;;;;;;AA0DA;KAAY,YAAA,IACV,WAAA,EAAa,mBAAA,EACb,UAAA,UACA,IAAA,eACG,OAAA,CAAQ,WAAA;;;;KAKD,SAAA,IACV,aAAA,EAAe,qBAAA,EACf,aAAA,UACA,UAAA,UACA,IAAA,YACA,mBAAA,WACA,OAAA,GAAU,SAAA,KACP,OAAA,CAAQ,cAAA;;;;;KAMD,YAAA,IACV,aAAA,UACA,UAAA,UACA,IAAA,eACG,aAAA;;;;;;AAjBL;;;iBA2BgB,0BAAA,CACd,IAAA,kBACA,MAAA,UACA,UAAA;;;;iBAwqBc,mBAAA,CAAA,GAAuB,gBAAA;;;;iBAwBvB,oBAAA,CACd,IAAA,kBACA,MAAA,WACC,UAAA;;;;iBAsBa,qBAAA,CACd,IAAA,kBACA,MAAA,UACA,UAAA;;;;;iBAgBc,kBAAA,CACd,IAAA,kBACA,MAAA,UACA,UAAA;AAhwBF;;;AAAA,iBAgxBgB,mBAAA,CAAA;EACd,KAAA;IAAA,CAAU,MAAA;EAAA;EACV,EAAA;IAAA,CAAO,MAAA;EAAA;AAAA;;;;;iBAsBO,eAAA,CAAgB,MAAA,WAAiB,YAAA;;;;AA/GjD;iBA+HgB,YAAA,CAAa,MAAA,WAAiB,SAAA;;;;AAvG9C;iBAuHgB,eAAA,CAAgB,MAAA,WAAiB,YAAA"}
|
package/dist/modules.js
CHANGED
|
@@ -8,15 +8,15 @@ import { routeGroupQuery } from "./queries/group.js";
|
|
|
8
8
|
import { routeSkuQuery } from "./queries/sku.js";
|
|
9
9
|
import { routeStakingQuery } from "./queries/staking.js";
|
|
10
10
|
import { routeWasmQuery } from "./queries/wasm.js";
|
|
11
|
-
import { routeBankTransaction } from "./transactions/bank.js";
|
|
12
|
-
import { routeBillingTransaction } from "./transactions/billing.js";
|
|
13
|
-
import { routeDistributionTransaction } from "./transactions/distribution.js";
|
|
14
|
-
import { routeGovTransaction } from "./transactions/gov.js";
|
|
15
|
-
import { routeGroupTransaction } from "./transactions/group.js";
|
|
16
|
-
import { routeManifestTransaction } from "./transactions/manifest.js";
|
|
17
|
-
import { routeSkuTransaction } from "./transactions/sku.js";
|
|
18
|
-
import { routeStakingTransaction } from "./transactions/staking.js";
|
|
19
|
-
import { routeWasmTransaction } from "./transactions/wasm.js";
|
|
11
|
+
import { buildBankMessages, routeBankTransaction } from "./transactions/bank.js";
|
|
12
|
+
import { buildBillingMessages, routeBillingTransaction } from "./transactions/billing.js";
|
|
13
|
+
import { buildDistributionMessages, routeDistributionTransaction } from "./transactions/distribution.js";
|
|
14
|
+
import { buildGovMessages, routeGovTransaction } from "./transactions/gov.js";
|
|
15
|
+
import { buildGroupMessages, routeGroupTransaction } from "./transactions/group.js";
|
|
16
|
+
import { buildManifestMessages, routeManifestTransaction } from "./transactions/manifest.js";
|
|
17
|
+
import { buildSkuMessages, routeSkuTransaction } from "./transactions/sku.js";
|
|
18
|
+
import { buildStakingMessages, routeStakingTransaction } from "./transactions/staking.js";
|
|
19
|
+
import { buildWasmMessages, routeWasmTransaction } from "./transactions/wasm.js";
|
|
20
20
|
//#region src/modules.ts
|
|
21
21
|
/**
|
|
22
22
|
* Throw an error for an unsupported subcommand.
|
|
@@ -506,6 +506,7 @@ const TX_MODULES = {
|
|
|
506
506
|
bank: {
|
|
507
507
|
description: "Bank transaction subcommands",
|
|
508
508
|
handler: routeBankTransaction,
|
|
509
|
+
msgBuilder: buildBankMessages,
|
|
509
510
|
subcommands: [{
|
|
510
511
|
name: "send",
|
|
511
512
|
description: "Send tokens to another account",
|
|
@@ -519,6 +520,7 @@ const TX_MODULES = {
|
|
|
519
520
|
staking: {
|
|
520
521
|
description: "Staking transaction subcommands",
|
|
521
522
|
handler: routeStakingTransaction,
|
|
523
|
+
msgBuilder: buildStakingMessages,
|
|
522
524
|
subcommands: [
|
|
523
525
|
{
|
|
524
526
|
name: "delegate",
|
|
@@ -541,6 +543,7 @@ const TX_MODULES = {
|
|
|
541
543
|
distribution: {
|
|
542
544
|
description: "Distribution transaction subcommands",
|
|
543
545
|
handler: routeDistributionTransaction,
|
|
546
|
+
msgBuilder: buildDistributionMessages,
|
|
544
547
|
subcommands: [
|
|
545
548
|
{
|
|
546
549
|
name: "withdraw-rewards",
|
|
@@ -559,6 +562,7 @@ const TX_MODULES = {
|
|
|
559
562
|
gov: {
|
|
560
563
|
description: "Governance transaction subcommands",
|
|
561
564
|
handler: routeGovTransaction,
|
|
565
|
+
msgBuilder: buildGovMessages,
|
|
562
566
|
subcommands: [
|
|
563
567
|
{
|
|
564
568
|
name: "vote",
|
|
@@ -577,6 +581,7 @@ const TX_MODULES = {
|
|
|
577
581
|
billing: {
|
|
578
582
|
description: "Manifest billing transaction subcommands",
|
|
579
583
|
handler: routeBillingTransaction,
|
|
584
|
+
msgBuilder: buildBillingMessages,
|
|
580
585
|
subcommands: [
|
|
581
586
|
{
|
|
582
587
|
name: "fund-credit",
|
|
@@ -628,6 +633,7 @@ const TX_MODULES = {
|
|
|
628
633
|
manifest: {
|
|
629
634
|
description: "Manifest module transaction subcommands",
|
|
630
635
|
handler: routeManifestTransaction,
|
|
636
|
+
msgBuilder: buildManifestMessages,
|
|
631
637
|
subcommands: [{
|
|
632
638
|
name: "payout",
|
|
633
639
|
description: "Execute a payout to multiple addresses"
|
|
@@ -639,6 +645,7 @@ const TX_MODULES = {
|
|
|
639
645
|
sku: {
|
|
640
646
|
description: "Manifest SKU module transaction subcommands",
|
|
641
647
|
handler: routeSkuTransaction,
|
|
648
|
+
msgBuilder: buildSkuMessages,
|
|
642
649
|
subcommands: [
|
|
643
650
|
{
|
|
644
651
|
name: "create-provider",
|
|
@@ -680,6 +687,7 @@ const TX_MODULES = {
|
|
|
680
687
|
group: {
|
|
681
688
|
description: "Group module transaction subcommands",
|
|
682
689
|
handler: routeGroupTransaction,
|
|
690
|
+
msgBuilder: buildGroupMessages,
|
|
683
691
|
subcommands: [
|
|
684
692
|
{
|
|
685
693
|
name: "create-group",
|
|
@@ -756,6 +764,7 @@ const TX_MODULES = {
|
|
|
756
764
|
wasm: {
|
|
757
765
|
description: "CosmWasm wasm transaction subcommands",
|
|
758
766
|
handler: routeWasmTransaction,
|
|
767
|
+
msgBuilder: buildWasmMessages,
|
|
759
768
|
subcommands: [
|
|
760
769
|
{
|
|
761
770
|
name: "store-code",
|
|
@@ -870,7 +879,16 @@ function getTxHandler(module) {
|
|
|
870
879
|
if (!moduleInfo) throw new ManifestMCPError(ManifestMCPErrorCode.UNKNOWN_MODULE, `Unknown tx module: ${module}`, { availableModules: Object.keys(TX_MODULES) });
|
|
871
880
|
return moduleInfo.handler;
|
|
872
881
|
}
|
|
882
|
+
/**
|
|
883
|
+
* Get the message builder function for a transaction module
|
|
884
|
+
* @throws ManifestMCPError if module is not found
|
|
885
|
+
*/
|
|
886
|
+
function getTxMsgBuilder(module) {
|
|
887
|
+
const moduleInfo = TX_MODULES[module];
|
|
888
|
+
if (!moduleInfo) throw new ManifestMCPError(ManifestMCPErrorCode.UNKNOWN_MODULE, `Unknown tx module: ${module}`, { availableModules: Object.keys(TX_MODULES) });
|
|
889
|
+
return moduleInfo.msgBuilder;
|
|
890
|
+
}
|
|
873
891
|
//#endregion
|
|
874
|
-
export { getAvailableModules, getModuleSubcommands, getQueryHandler, getSubcommandUsage, getSupportedModules, getTxHandler, isSubcommandSupported, throwUnsupportedSubcommand };
|
|
892
|
+
export { getAvailableModules, getModuleSubcommands, getQueryHandler, getSubcommandUsage, getSupportedModules, getTxHandler, getTxMsgBuilder, isSubcommandSupported, throwUnsupportedSubcommand };
|
|
875
893
|
|
|
876
894
|
//# sourceMappingURL=modules.js.map
|
package/dist/modules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.js","names":[],"sources":["../src/modules.ts"],"sourcesContent":["import type { SigningStargateClient } from '@cosmjs/stargate';\nimport type { ManifestQueryClient } from './client.js';\nimport { routeAuthQuery } from './queries/auth.js';\n\n// Import query handlers\nimport { routeBankQuery } from './queries/bank.js';\nimport { routeBillingQuery } from './queries/billing.js';\nimport { routeDistributionQuery } from './queries/distribution.js';\nimport { routeGovQuery } from './queries/gov.js';\nimport { routeGroupQuery } from './queries/group.js';\nimport { routeSkuQuery } from './queries/sku.js';\nimport { routeStakingQuery } from './queries/staking.js';\nimport { routeWasmQuery } from './queries/wasm.js';\n// Import transaction handlers\nimport { routeBankTransaction } from './transactions/bank.js';\nimport { routeBillingTransaction } from './transactions/billing.js';\nimport { routeDistributionTransaction } from './transactions/distribution.js';\nimport { routeGovTransaction } from './transactions/gov.js';\nimport { routeGroupTransaction } from './transactions/group.js';\nimport { routeManifestTransaction } from './transactions/manifest.js';\nimport { routeSkuTransaction } from './transactions/sku.js';\nimport { routeStakingTransaction } from './transactions/staking.js';\nimport { routeWasmTransaction } from './transactions/wasm.js';\nimport {\n type AvailableModules,\n type CosmosTxResult,\n ManifestMCPError,\n ManifestMCPErrorCode,\n type ModuleInfo,\n type QueryResult,\n type TxOptions,\n} from './types.js';\n\n/**\n * Handler function type for query modules\n */\nexport type QueryHandler = (\n queryClient: ManifestQueryClient,\n subcommand: string,\n args: string[],\n) => Promise<QueryResult>;\n\n/**\n * Handler function type for transaction modules\n */\nexport type TxHandler = (\n signingClient: SigningStargateClient,\n senderAddress: string,\n subcommand: string,\n args: string[],\n waitForConfirmation: boolean,\n options?: TxOptions,\n) => Promise<CosmosTxResult>;\n\n/**\n * Throw an error for an unsupported subcommand.\n * Automatically looks up available subcommands from the module registry.\n *\n * @param type - 'query' or 'tx'\n * @param module - The module name (e.g., 'bank', 'staking')\n * @param subcommand - The unsupported subcommand that was requested\n */\nexport function throwUnsupportedSubcommand(\n type: 'query' | 'tx',\n module: string,\n subcommand: string,\n): never {\n const registry = type === 'query' ? QUERY_MODULES : TX_MODULES;\n const moduleInfo = registry[module];\n const availableSubcommands = moduleInfo?.subcommands.map((s) => s.name) ?? [];\n\n throw new ManifestMCPError(\n type === 'query'\n ? ManifestMCPErrorCode.UNSUPPORTED_QUERY\n : ManifestMCPErrorCode.UNSUPPORTED_TX,\n `Unsupported ${module} ${type === 'query' ? 'query' : 'transaction'} subcommand: ${subcommand}`,\n { availableSubcommands },\n );\n}\n\n/**\n * Static module registry for browser-compatible module discovery\n * All modules use manifestjs for full protobuf support\n */\n\ninterface SubcommandInfo {\n name: string;\n description: string;\n args?: string; // Usage hint for arguments\n}\n\ninterface QueryModuleRegistry {\n [moduleName: string]: {\n description: string;\n subcommands: SubcommandInfo[];\n handler: QueryHandler;\n };\n}\n\ninterface TxModuleRegistry {\n [moduleName: string]: {\n description: string;\n subcommands: SubcommandInfo[];\n handler: TxHandler;\n };\n}\n\n/**\n * Query modules registry\n * Each module includes metadata and its handler function\n */\nconst QUERY_MODULES: QueryModuleRegistry = {\n bank: {\n description: 'Querying commands for the bank module',\n handler: routeBankQuery,\n subcommands: [\n {\n name: 'balance',\n description: 'Query account balance for a specific denom',\n },\n { name: 'balances', description: 'Query all balances for an account' },\n {\n name: 'spendable-balances',\n description: 'Query spendable balances for an account',\n },\n { name: 'total-supply', description: 'Query total supply of all tokens' },\n {\n name: 'total',\n description:\n 'Query total supply of all tokens (alias for total-supply)',\n },\n { name: 'supply-of', description: 'Query supply of a specific denom' },\n { name: 'params', description: 'Query bank parameters' },\n {\n name: 'denom-metadata',\n description: 'Query metadata for a specific denom',\n },\n { name: 'denoms-metadata', description: 'Query metadata for all denoms' },\n {\n name: 'send-enabled',\n description: 'Query send enabled status for denoms',\n },\n ],\n },\n staking: {\n description: 'Querying commands for the staking module',\n handler: routeStakingQuery,\n subcommands: [\n { name: 'delegation', description: 'Query a delegation' },\n {\n name: 'delegations',\n description: 'Query all delegations for a delegator',\n },\n {\n name: 'unbonding-delegation',\n description: 'Query an unbonding delegation',\n },\n {\n name: 'unbonding-delegations',\n description: 'Query all unbonding delegations for a delegator',\n },\n { name: 'redelegations', description: 'Query redelegations' },\n { name: 'validator', description: 'Query a validator' },\n { name: 'validators', description: 'Query all validators' },\n {\n name: 'validator-delegations',\n description: 'Query all delegations to a validator',\n },\n {\n name: 'validator-unbonding-delegations',\n description: 'Query all unbonding delegations from a validator',\n },\n { name: 'pool', description: 'Query staking pool' },\n { name: 'params', description: 'Query staking parameters' },\n {\n name: 'historical-info',\n description: 'Query historical info at a height',\n },\n ],\n },\n distribution: {\n description: 'Querying commands for the distribution module',\n handler: routeDistributionQuery,\n subcommands: [\n {\n name: 'rewards',\n description: 'Query distribution rewards for a delegator',\n },\n { name: 'commission', description: 'Query validator commission' },\n { name: 'community-pool', description: 'Query community pool coins' },\n { name: 'params', description: 'Query distribution parameters' },\n {\n name: 'validator-outstanding-rewards',\n description: 'Query validator outstanding rewards',\n },\n { name: 'slashes', description: 'Query slashes for a validator' },\n {\n name: 'delegator-validators',\n description: 'Query validators for a delegator',\n },\n {\n name: 'delegator-withdraw-address',\n description: 'Query delegator withdraw address',\n },\n ],\n },\n gov: {\n description: 'Querying commands for the governance module',\n handler: routeGovQuery,\n subcommands: [\n { name: 'proposal', description: 'Query a proposal by ID' },\n { name: 'proposals', description: 'Query all proposals' },\n { name: 'vote', description: 'Query a vote on a proposal' },\n { name: 'votes', description: 'Query all votes on a proposal' },\n { name: 'deposit', description: 'Query a deposit on a proposal' },\n { name: 'deposits', description: 'Query all deposits on a proposal' },\n { name: 'tally', description: 'Query tally of a proposal' },\n { name: 'params', description: 'Query governance parameters' },\n ],\n },\n auth: {\n description: 'Querying commands for the auth module',\n handler: routeAuthQuery,\n subcommands: [\n { name: 'account', description: 'Query account by address' },\n { name: 'accounts', description: 'Query all accounts' },\n { name: 'params', description: 'Query auth parameters' },\n { name: 'module-accounts', description: 'Query all module accounts' },\n {\n name: 'module-account-by-name',\n description: 'Query module account by name',\n },\n {\n name: 'address-bytes-to-string',\n description: 'Convert address bytes to string',\n },\n {\n name: 'address-string-to-bytes',\n description: 'Convert address string to bytes',\n },\n { name: 'bech32-prefix', description: 'Query bech32 prefix' },\n { name: 'account-info', description: 'Query account info' },\n ],\n },\n billing: {\n description: 'Querying commands for the Manifest billing module',\n handler: routeBillingQuery,\n subcommands: [\n { name: 'params', description: 'Query billing parameters' },\n { name: 'lease', description: 'Query a lease by UUID' },\n { name: 'leases', description: 'Query all leases' },\n {\n name: 'leases-by-tenant',\n description: 'Query leases by tenant address',\n },\n { name: 'leases-by-provider', description: 'Query leases by provider' },\n { name: 'leases-by-sku', description: 'Query leases by SKU UUID' },\n {\n name: 'credit-account',\n description: 'Query credit account for a tenant',\n },\n { name: 'credit-accounts', description: 'Query all credit accounts' },\n {\n name: 'credit-address',\n description: 'Query credit address for a tenant',\n },\n {\n name: 'withdrawable-amount',\n description: 'Query withdrawable amount for a lease',\n },\n {\n name: 'provider-withdrawable',\n description: 'Query withdrawable amount for a provider',\n },\n {\n name: 'credit-estimate',\n description: 'Query credit estimate for a tenant',\n },\n ],\n },\n sku: {\n description: 'Querying commands for the Manifest SKU module',\n handler: routeSkuQuery,\n subcommands: [\n { name: 'params', description: 'Query SKU module parameters' },\n {\n name: 'provider',\n description: 'Query a provider by UUID',\n args: '<provider-uuid>',\n },\n {\n name: 'providers',\n description: 'Query all providers',\n args: '[--active-only] [--limit N]',\n },\n { name: 'sku', description: 'Query a SKU by UUID', args: '<sku-uuid>' },\n {\n name: 'skus',\n description: 'Query all SKUs',\n args: '[--active-only] [--limit N]',\n },\n {\n name: 'skus-by-provider',\n description: 'Query SKUs by provider UUID',\n args: '<provider-uuid> [--active-only] [--limit N]',\n },\n {\n name: 'provider-by-address',\n description: 'Query providers by address',\n args: '<address> [--active-only] [--limit N]',\n },\n ],\n },\n group: {\n description: 'Querying commands for the group module',\n handler: routeGroupQuery,\n subcommands: [\n {\n name: 'group-info',\n description: 'Query group info by ID',\n args: '<group-id>',\n },\n {\n name: 'group-policy-info',\n description: 'Query group policy info by address',\n args: '<group-policy-address>',\n },\n {\n name: 'group-members',\n description: 'Query group members',\n args: '<group-id> [--limit N]',\n },\n {\n name: 'groups-by-admin',\n description: 'Query groups by admin address',\n args: '<admin-address> [--limit N]',\n },\n {\n name: 'group-policies-by-group',\n description: 'Query group policies by group ID',\n args: '<group-id> [--limit N]',\n },\n {\n name: 'group-policies-by-admin',\n description: 'Query group policies by admin address',\n args: '<admin-address> [--limit N]',\n },\n {\n name: 'proposal',\n description: 'Query a group proposal by ID',\n args: '<proposal-id>',\n },\n {\n name: 'proposals-by-group-policy',\n description: 'Query proposals by group policy address',\n args: '<group-policy-address> [--limit N]',\n },\n {\n name: 'vote',\n description: 'Query a vote by proposal ID and voter',\n args: '<proposal-id> <voter-address>',\n },\n {\n name: 'votes-by-proposal',\n description: 'Query votes by proposal ID',\n args: '<proposal-id> [--limit N]',\n },\n {\n name: 'votes-by-voter',\n description: 'Query votes by voter address',\n args: '<voter-address> [--limit N]',\n },\n {\n name: 'groups-by-member',\n description: 'Query groups by member address',\n args: '<member-address> [--limit N]',\n },\n {\n name: 'tally',\n description: 'Query tally result for a proposal',\n args: '<proposal-id>',\n },\n { name: 'groups', description: 'Query all groups', args: '[--limit N]' },\n ],\n },\n wasm: {\n description: 'Querying commands for the CosmWasm wasm module',\n handler: routeWasmQuery,\n subcommands: [\n {\n name: 'contract-info',\n description: 'Query contract info by address',\n args: '<address>',\n },\n {\n name: 'contract-history',\n description: 'Query contract code history',\n args: '<address> [--limit N]',\n },\n {\n name: 'contracts-by-code',\n description: 'Query contracts by code ID',\n args: '<code_id> [--limit N]',\n },\n {\n name: 'all-contract-state',\n description: 'Query all key-value pairs in contract state',\n args: '<address> [--limit N]',\n },\n {\n name: 'raw-contract-state',\n description: 'Query raw contract state by hex-encoded key',\n args: '<address> <query_data_hex>',\n },\n {\n name: 'smart-contract-state',\n description: 'Execute a smart query against a contract',\n args: '<address> <query_json>',\n },\n {\n name: 'code',\n description: 'Query code info and data by code ID',\n args: '<code_id>',\n },\n {\n name: 'codes',\n description: 'Query all stored wasm codes',\n args: '[--limit N]',\n },\n {\n name: 'code-info',\n description: 'Query code metadata by code ID',\n args: '<code_id>',\n },\n {\n name: 'pinned-codes',\n description: 'Query pinned code IDs',\n args: '[--limit N]',\n },\n { name: 'params', description: 'Query wasm module parameters' },\n {\n name: 'contracts-by-creator',\n description: 'Query contracts by creator address',\n args: '<creator_address> [--limit N]',\n },\n {\n name: 'wasm-limits-config',\n description: 'Query wasm limits configuration',\n },\n {\n name: 'build-address',\n description:\n 'Compute contract address from code hash, creator, and salt',\n args: '<code_hash> <creator_address> <salt>',\n },\n ],\n },\n};\n\n/**\n * Transaction modules registry\n * Each module includes metadata and its handler function\n */\nconst TX_MODULES: TxModuleRegistry = {\n bank: {\n description: 'Bank transaction subcommands',\n handler: routeBankTransaction,\n subcommands: [\n {\n name: 'send',\n description: 'Send tokens to another account',\n args: '<to-address> <amount> (e.g., manifest1abc... 1000000umfx)',\n },\n {\n name: 'multi-send',\n description: 'Send tokens to multiple accounts',\n args: '<to-address:amount>... (e.g., manifest1a:1000umfx manifest1b:2000umfx)',\n },\n ],\n },\n staking: {\n description: 'Staking transaction subcommands',\n handler: routeStakingTransaction,\n subcommands: [\n { name: 'delegate', description: 'Delegate tokens to a validator' },\n { name: 'unbond', description: 'Unbond tokens from a validator' },\n {\n name: 'undelegate',\n description: 'Unbond tokens from a validator (alias for unbond)',\n },\n {\n name: 'redelegate',\n description: 'Redelegate tokens from one validator to another',\n },\n ],\n },\n distribution: {\n description: 'Distribution transaction subcommands',\n handler: routeDistributionTransaction,\n subcommands: [\n {\n name: 'withdraw-rewards',\n description: 'Withdraw rewards from a validator',\n },\n { name: 'set-withdraw-addr', description: 'Set withdraw address' },\n { name: 'fund-community-pool', description: 'Fund the community pool' },\n ],\n },\n gov: {\n description: 'Governance transaction subcommands',\n handler: routeGovTransaction,\n subcommands: [\n { name: 'vote', description: 'Vote on a proposal' },\n { name: 'weighted-vote', description: 'Weighted vote on a proposal' },\n { name: 'deposit', description: 'Deposit tokens for a proposal' },\n ],\n },\n billing: {\n description: 'Manifest billing transaction subcommands',\n handler: routeBillingTransaction,\n subcommands: [\n {\n name: 'fund-credit',\n description: 'Fund credit for a tenant',\n args: '<tenant-address> <amount> (e.g., manifest1abc... 1000000umfx)',\n },\n {\n name: 'create-lease',\n description: 'Create a new lease',\n args: '[--meta-hash <hex>] <sku-uuid:quantity[:service-name]>... (e.g., sku-123:1 or sku-123:1:web sku-123:1:db)',\n },\n {\n name: 'close-lease',\n description: 'Close one or more leases',\n args: '[--reason <text>] <lease-uuid>... (e.g., lease-123 lease-456)',\n },\n {\n name: 'withdraw',\n description: 'Withdraw earnings from leases',\n args: '<lease-uuid>... OR --provider <provider-uuid> [--limit <1-100>]',\n },\n {\n name: 'create-lease-for-tenant',\n description: 'Create a lease on behalf of a tenant',\n args: '<tenant-address> [--meta-hash <hex>] <sku-uuid:quantity[:service-name]>...',\n },\n {\n name: 'acknowledge-lease',\n description: 'Acknowledge one or more pending leases',\n args: '<lease-uuid>...',\n },\n {\n name: 'reject-lease',\n description: 'Reject one or more pending leases',\n args: '[--reason <text>] <lease-uuid>...',\n },\n {\n name: 'cancel-lease',\n description: 'Cancel one or more pending leases',\n args: '<lease-uuid>...',\n },\n {\n name: 'update-params',\n description: 'Update billing module parameters (governance)',\n args: '<max-leases-per-tenant> <max-items-per-lease> <min-lease-duration> <max-pending-leases-per-tenant> <pending-timeout> [<allowed-address>...]',\n },\n ],\n },\n manifest: {\n description: 'Manifest module transaction subcommands',\n handler: routeManifestTransaction,\n subcommands: [\n { name: 'payout', description: 'Execute a payout to multiple addresses' },\n { name: 'burn-held-balance', description: 'Burn held balance' },\n ],\n },\n sku: {\n description: 'Manifest SKU module transaction subcommands',\n handler: routeSkuTransaction,\n subcommands: [\n {\n name: 'create-provider',\n description: 'Create a new provider',\n args: '<address> <payout-address> <api-url> [--meta-hash <hex>]',\n },\n {\n name: 'update-provider',\n description: 'Update an existing provider',\n args: '<provider-uuid> <address> <payout-address> <api-url> [--meta-hash <hex>] [--active <true|false>]',\n },\n {\n name: 'deactivate-provider',\n description: 'Deactivate a provider',\n args: '<provider-uuid>',\n },\n {\n name: 'create-sku',\n description: 'Create a new SKU',\n args: '<provider-uuid> <name> <unit (per-hour|per-day)> <base-price> [--meta-hash <hex>]',\n },\n {\n name: 'update-sku',\n description: 'Update an existing SKU',\n args: '<sku-uuid> <provider-uuid> <name> <unit (per-hour|per-day)> <base-price> [--meta-hash <hex>] [--active <true|false>]',\n },\n {\n name: 'deactivate-sku',\n description: 'Deactivate a SKU',\n args: '<sku-uuid>',\n },\n {\n name: 'update-params',\n description: 'Update SKU module parameters (governance)',\n args: '<allowed-address>...',\n },\n ],\n },\n group: {\n description: 'Group module transaction subcommands',\n handler: routeGroupTransaction,\n subcommands: [\n {\n name: 'create-group',\n description: 'Create a new group',\n args: '<metadata> <address:weight>...',\n },\n {\n name: 'update-group-members',\n description: 'Update group members',\n args: '<group-id> <address:weight>...',\n },\n {\n name: 'update-group-admin',\n description: 'Update group admin',\n args: '<group-id> <new-admin-address>',\n },\n {\n name: 'update-group-metadata',\n description: 'Update group metadata',\n args: '<group-id> <metadata>',\n },\n {\n name: 'create-group-policy',\n description: 'Create a group policy',\n args: '<group-id> <metadata> <policy-type> <threshold-or-pct> <voting-period-secs> <min-execution-period-secs>',\n },\n {\n name: 'update-group-policy-admin',\n description: 'Update group policy admin',\n args: '<group-policy-address> <new-admin-address>',\n },\n {\n name: 'create-group-with-policy',\n description: 'Create a group with policy',\n args: '<group-metadata> <group-policy-metadata> <policy-type> <threshold-or-pct> <voting-period-secs> <min-execution-period-secs> [--group-policy-as-admin] <address:weight>...',\n },\n {\n name: 'update-group-policy-decision-policy',\n description: 'Update group policy decision policy',\n args: '<group-policy-address> <policy-type> <threshold-or-pct> <voting-period-secs> <min-execution-period-secs>',\n },\n {\n name: 'update-group-policy-metadata',\n description: 'Update group policy metadata',\n args: '<group-policy-address> <metadata>',\n },\n {\n name: 'submit-proposal',\n description: 'Submit a group proposal',\n args: '<group-policy-address> <title> <summary> [--exec try] [--metadata <text>] [<message-json>...]',\n },\n {\n name: 'withdraw-proposal',\n description: 'Withdraw a group proposal',\n args: '<proposal-id>',\n },\n {\n name: 'vote',\n description: 'Vote on a group proposal',\n args: '<proposal-id> <option (yes|no|abstain|no_with_veto)> [--metadata <text>] [--exec try]',\n },\n {\n name: 'exec',\n description: 'Execute a passed group proposal',\n args: '<proposal-id>',\n },\n { name: 'leave-group', description: 'Leave a group', args: '<group-id>' },\n ],\n },\n wasm: {\n description: 'CosmWasm wasm transaction subcommands',\n handler: routeWasmTransaction,\n subcommands: [\n {\n name: 'store-code',\n description: 'Upload wasm contract code (base64-encoded)',\n args: '<wasm_bytes_base64> [--instantiate-permission everybody|nobody|addr1,addr2] [--memo <text>]',\n },\n {\n name: 'instantiate',\n description: 'Instantiate a contract from a code ID',\n args: '<code_id> <json_msg> <label> [--admin <addr>] [--funds <number><denom>[,<number><denom>...]] [--memo <text>]',\n },\n {\n name: 'instantiate2',\n description: 'Instantiate a contract with a predictable address',\n args: '<code_id> <json_msg> <label> <salt> [--admin <addr>] [--funds <number><denom>[,<number><denom>...]] [--memo <text>]',\n },\n {\n name: 'execute',\n description: 'Execute a smart contract',\n args: '<contract_address> <json_msg> [--funds <number><denom>[,<number><denom>...]] [--memo <text>]',\n },\n {\n name: 'migrate',\n description: 'Migrate a contract to a new code version',\n args: '<contract_address> <new_code_id> <json_msg> [--memo <text>]',\n },\n {\n name: 'update-admin',\n description: 'Update the admin of a contract',\n args: '<contract_address> <new_admin> [--memo <text>]',\n },\n {\n name: 'clear-admin',\n description: 'Remove the admin of a contract',\n args: '<contract_address> [--memo <text>]',\n },\n ],\n },\n};\n\n/**\n * Get all available query and transaction modules\n */\nexport function getAvailableModules(): AvailableModules {\n const queryModules: ModuleInfo[] = Object.entries(QUERY_MODULES).map(\n ([name, info]) => ({\n name,\n description: info.description,\n }),\n );\n\n const txModules: ModuleInfo[] = Object.entries(TX_MODULES).map(\n ([name, info]) => ({\n name,\n description: info.description,\n }),\n );\n\n return {\n queryModules,\n txModules,\n };\n}\n\n/**\n * Get available subcommands for a specific module\n */\nexport function getModuleSubcommands(\n type: 'query' | 'tx',\n module: string,\n): ModuleInfo[] {\n const registry = type === 'query' ? QUERY_MODULES : TX_MODULES;\n const moduleInfo = registry[module];\n\n if (!moduleInfo) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.UNKNOWN_MODULE,\n `Unknown ${type} module: ${module}`,\n { availableModules: Object.keys(registry) },\n );\n }\n\n return moduleInfo.subcommands.map((sub) => ({\n name: sub.name,\n description: sub.description,\n args: sub.args,\n }));\n}\n\n/**\n * Check if a module/subcommand combination is supported\n */\nexport function isSubcommandSupported(\n type: 'query' | 'tx',\n module: string,\n subcommand: string,\n): boolean {\n const registry = type === 'query' ? QUERY_MODULES : TX_MODULES;\n const moduleInfo = registry[module];\n\n if (!moduleInfo) {\n return false;\n }\n\n return moduleInfo.subcommands.some((s) => s.name === subcommand);\n}\n\n/**\n * Get usage help for a specific subcommand\n * Returns the args string if available, or undefined\n */\nexport function getSubcommandUsage(\n type: 'query' | 'tx',\n module: string,\n subcommand: string,\n): string | undefined {\n const registry = type === 'query' ? QUERY_MODULES : TX_MODULES;\n const moduleInfo = registry[module];\n\n if (!moduleInfo) {\n return undefined;\n }\n\n const sub = moduleInfo.subcommands.find((s) => s.name === subcommand);\n return sub?.args;\n}\n\n/**\n * Get supported modules list\n */\nexport function getSupportedModules(): {\n query: { [module: string]: string[] };\n tx: { [module: string]: string[] };\n} {\n const result = {\n query: {} as { [module: string]: string[] },\n tx: {} as { [module: string]: string[] },\n };\n\n for (const [module, info] of Object.entries(QUERY_MODULES)) {\n result.query[module] = info.subcommands.map((s) => s.name);\n }\n\n for (const [module, info] of Object.entries(TX_MODULES)) {\n result.tx[module] = info.subcommands.map((s) => s.name);\n }\n\n return result;\n}\n\n/**\n * Get the handler function for a query module\n * @throws ManifestMCPError if module is not found\n */\nexport function getQueryHandler(module: string): QueryHandler {\n const moduleInfo = QUERY_MODULES[module];\n if (!moduleInfo) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.UNKNOWN_MODULE,\n `Unknown query module: ${module}`,\n { availableModules: Object.keys(QUERY_MODULES) },\n );\n }\n return moduleInfo.handler;\n}\n\n/**\n * Get the handler function for a transaction module\n * @throws ManifestMCPError if module is not found\n */\nexport function getTxHandler(module: string): TxHandler {\n const moduleInfo = TX_MODULES[module];\n if (!moduleInfo) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.UNKNOWN_MODULE,\n `Unknown tx module: ${module}`,\n { availableModules: Object.keys(TX_MODULES) },\n );\n }\n return moduleInfo.handler;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,2BACd,MACA,QACA,YACO;CAGP,MAAM,wBAFW,SAAS,UAAU,gBAAgB,YACxB,SACa,YAAY,KAAK,MAAM,EAAE,KAAK,IAAI,EAAE;AAE7E,OAAM,IAAI,iBACR,SAAS,UACL,qBAAqB,oBACrB,qBAAqB,gBACzB,eAAe,OAAO,GAAG,SAAS,UAAU,UAAU,cAAc,eAAe,cACnF,EAAE,sBAAsB,CACzB;;;;;;AAkCH,MAAM,gBAAqC;CACzC,MAAM;EACJ,aAAa;EACb,SAAS;EACT,aAAa;GACX;IACE,MAAM;IACN,aAAa;IACd;GACD;IAAE,MAAM;IAAY,aAAa;IAAqC;GACtE;IACE,MAAM;IACN,aAAa;IACd;GACD;IAAE,MAAM;IAAgB,aAAa;IAAoC;GACzE;IACE,MAAM;IACN,aACE;IACH;GACD;IA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AAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACF;EACF;CACD,OAAO;EACL,aAAa;EACb,SAAS;EACT,aAAa;GACX;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IAAE,MAAM;IAAU,aAAa;IAAoB,MAAM;IAAe;GACzE;EACF;CACD,MAAM;EACJ,aAAa;EACb,SAAS;EACT,aAAa;GACX;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IAAE,MAAM;IAAU,aAAa;IAAgC;GAC/D;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACd;GACD;IACE,MAAM;IACN,aACE;IACF,MAAM;IACP;GACF;EACF;CACF;;;;;AAMD,MAAM,aAA+B;CACnC,MAAM;EACJ,aAAa;EACb,SAAS;EACT,aAAa,CACX;GACE,MAAM;GACN,aAAa;GACb,MAAM;GACP,EACD;GACE,MAAM;GACN,aAAa;GACb,MAAM;GACP,CACF;EACF;CACD,SAAS;EACP,aAAa;EACb,SAAS;EACT,aAAa;GACX;IAAE,MAAM;IAAY,aAAa;IAAkC;GACnE;IAAE,MAAM;IAAU,aAAa;IAAkC;GACjE;IACE,MAAM;IACN,aAAa;IACd;GACD;IACE,MAAM;IACN,aAAa;IACd;GACF;EACF;CACD,cAAc;EACZ,aAAa;EACb,SAAS;EACT,aAAa;GACX;IACE,MAAM;IACN,aAAa;IACd;GACD;IAAE,MAAM;IAAqB,aAAa;IAAwB;GAClE;IAAE,MAAM;IAAuB,aAAa;IAA2B;GACxE;EACF;CACD,KAAK;EACH,aAAa;EACb,SAAS;EACT,aAAa;GACX;IAAE,MAAM;IAAQ,aAAa;IAAsB;GACnD;IAAE,MAAM;IAAiB,aAAa;IAA+B;GACrE;IAAE,MAAM;IAAW,aAAa;IAAiC;GAClE;EACF;CACD,SAAS;EACP,aAAa;EACb,SAAS;EACT,aAAa;GACX;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACF;EACF;CACD,UAAU;EACR,aAAa;EACb,SAAS;EACT,aAAa,CACX;GAAE,MAAM;GAAU,aAAa;GAA0C,EACzE;GAAE,MAAM;GAAqB,aAAa;GAAqB,CAChE;EACF;CACD,KAAK;EACH,aAAa;EACb,SAAS;EACT,aAAa;GACX;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACF;EACF;CACD,OAAO;EACL,aAAa;EACb,SAAS;EACT,aAAa;GACX;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IAAE,MAAM;IAAe,aAAa;IAAiB,MAAM;IAAc;GAC1E;EACF;CACD,MAAM;EACJ,aAAa;EACb,SAAS;EACT,aAAa;GACX;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MA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ED,MAAK,MAAM,CAAC,QAAQ,SAAS,OAAO,QAAQ,cAAc,CACxD,QAAO,MAAM,UAAU,KAAK,YAAY,KAAK,MAAM,EAAE,KAAK;AAG5D,MAAK,MAAM,CAAC,QAAQ,SAAS,OAAO,QAAQ,WAAW,CACrD,QAAO,GAAG,UAAU,KAAK,YAAY,KAAK,MAAM,EAAE,KAAK;AAGzD,QAAO;;;;;;AAOT,SAAgB,gBAAgB,QAA8B;CAC5D,MAAM,aAAa,cAAc;AACjC,KAAI,CAAC,WACH,OAAM,IAAI,iBACR,qBAAqB,gBACrB,yBAAyB,UACzB,EAAE,kBAAkB,OAAO,KAAK,cAAc,EAAE,CACjD;AAEH,QAAO,WAAW;;;;;;AAOpB,SAAgB,aAAa,QAA2B;CACtD,MAAM,aAAa,WAAW;AAC9B,KAAI,CAAC,WACH,OAAM,IAAI,iBACR,qBAAqB,gBACrB,sBAAsB,UACtB,EAAE,kBAAkB,OAAO,KAAK,WAAW,EAAE,CAC9C;AAEH,QAAO,WAAW"}
|
|
1
|
+
{"version":3,"file":"modules.js","names":[],"sources":["../src/modules.ts"],"sourcesContent":["import type { SigningStargateClient } from '@cosmjs/stargate';\nimport type { ManifestQueryClient } from './client.js';\nimport { routeAuthQuery } from './queries/auth.js';\n\n// Import query handlers\nimport { routeBankQuery } from './queries/bank.js';\nimport { routeBillingQuery } from './queries/billing.js';\nimport { routeDistributionQuery } from './queries/distribution.js';\nimport { routeGovQuery } from './queries/gov.js';\nimport { routeGroupQuery } from './queries/group.js';\nimport { routeSkuQuery } from './queries/sku.js';\nimport { routeStakingQuery } from './queries/staking.js';\nimport { routeWasmQuery } from './queries/wasm.js';\n// Import transaction handlers\nimport {\n buildBankMessages,\n routeBankTransaction,\n} from './transactions/bank.js';\nimport {\n buildBillingMessages,\n routeBillingTransaction,\n} from './transactions/billing.js';\nimport {\n buildDistributionMessages,\n routeDistributionTransaction,\n} from './transactions/distribution.js';\nimport { buildGovMessages, routeGovTransaction } from './transactions/gov.js';\nimport {\n buildGroupMessages,\n routeGroupTransaction,\n} from './transactions/group.js';\nimport {\n buildManifestMessages,\n routeManifestTransaction,\n} from './transactions/manifest.js';\nimport { buildSkuMessages, routeSkuTransaction } from './transactions/sku.js';\nimport {\n buildStakingMessages,\n routeStakingTransaction,\n} from './transactions/staking.js';\nimport {\n buildWasmMessages,\n routeWasmTransaction,\n} from './transactions/wasm.js';\nimport {\n type AvailableModules,\n type BuiltMessages,\n type CosmosTxResult,\n ManifestMCPError,\n ManifestMCPErrorCode,\n type ModuleInfo,\n type QueryResult,\n type TxOptions,\n} from './types.js';\n\n/**\n * Handler function type for query modules\n */\nexport type QueryHandler = (\n queryClient: ManifestQueryClient,\n subcommand: string,\n args: string[],\n) => Promise<QueryResult>;\n\n/**\n * Handler function type for transaction modules\n */\nexport type TxHandler = (\n signingClient: SigningStargateClient,\n senderAddress: string,\n subcommand: string,\n args: string[],\n waitForConfirmation: boolean,\n options?: TxOptions,\n) => Promise<CosmosTxResult>;\n\n/**\n * Pure synchronous function type for building transaction messages.\n * Used by `cosmosEstimateFee` to obtain `EncodeObject[]` without signing/broadcasting.\n */\nexport type TxMsgBuilder = (\n senderAddress: string,\n subcommand: string,\n args: string[],\n) => BuiltMessages;\n\n/**\n * Throw an error for an unsupported subcommand.\n * Automatically looks up available subcommands from the module registry.\n *\n * @param type - 'query' or 'tx'\n * @param module - The module name (e.g., 'bank', 'staking')\n * @param subcommand - The unsupported subcommand that was requested\n */\nexport function throwUnsupportedSubcommand(\n type: 'query' | 'tx',\n module: string,\n subcommand: string,\n): never {\n const registry = type === 'query' ? QUERY_MODULES : TX_MODULES;\n const moduleInfo = registry[module];\n const availableSubcommands = moduleInfo?.subcommands.map((s) => s.name) ?? [];\n\n throw new ManifestMCPError(\n type === 'query'\n ? ManifestMCPErrorCode.UNSUPPORTED_QUERY\n : ManifestMCPErrorCode.UNSUPPORTED_TX,\n `Unsupported ${module} ${type === 'query' ? 'query' : 'transaction'} subcommand: ${subcommand}`,\n { availableSubcommands },\n );\n}\n\n/**\n * Static module registry for browser-compatible module discovery\n * All modules use manifestjs for full protobuf support\n */\n\ninterface SubcommandInfo {\n name: string;\n description: string;\n args?: string; // Usage hint for arguments\n}\n\ninterface QueryModuleRegistry {\n [moduleName: string]: {\n description: string;\n subcommands: SubcommandInfo[];\n handler: QueryHandler;\n };\n}\n\ninterface TxModuleRegistry {\n [moduleName: string]: {\n description: string;\n subcommands: SubcommandInfo[];\n handler: TxHandler;\n msgBuilder: TxMsgBuilder;\n };\n}\n\n/**\n * Query modules registry\n * Each module includes metadata and its handler function\n */\nconst QUERY_MODULES: QueryModuleRegistry = {\n bank: {\n description: 'Querying commands for the bank module',\n handler: routeBankQuery,\n subcommands: [\n {\n name: 'balance',\n description: 'Query account balance for a specific denom',\n },\n { name: 'balances', description: 'Query all balances for an account' },\n {\n name: 'spendable-balances',\n description: 'Query spendable balances for an account',\n },\n { name: 'total-supply', description: 'Query total supply of all tokens' },\n {\n name: 'total',\n description:\n 'Query total supply of all tokens (alias for total-supply)',\n },\n { name: 'supply-of', description: 'Query supply of a specific denom' },\n { name: 'params', description: 'Query bank parameters' },\n {\n name: 'denom-metadata',\n description: 'Query metadata for a specific denom',\n },\n { name: 'denoms-metadata', description: 'Query metadata for all denoms' },\n {\n name: 'send-enabled',\n description: 'Query send enabled status for denoms',\n },\n ],\n },\n staking: {\n description: 'Querying commands for the staking module',\n handler: routeStakingQuery,\n subcommands: [\n { name: 'delegation', description: 'Query a delegation' },\n {\n name: 'delegations',\n description: 'Query all delegations for a delegator',\n },\n {\n name: 'unbonding-delegation',\n description: 'Query an unbonding delegation',\n },\n {\n name: 'unbonding-delegations',\n description: 'Query all unbonding delegations for a delegator',\n },\n { name: 'redelegations', description: 'Query redelegations' },\n { name: 'validator', description: 'Query a validator' },\n { name: 'validators', description: 'Query all validators' },\n {\n name: 'validator-delegations',\n description: 'Query all delegations to a validator',\n },\n {\n name: 'validator-unbonding-delegations',\n description: 'Query all unbonding delegations from a validator',\n },\n { name: 'pool', description: 'Query staking pool' },\n { name: 'params', description: 'Query staking parameters' },\n {\n name: 'historical-info',\n description: 'Query historical info at a height',\n },\n ],\n },\n distribution: {\n description: 'Querying commands for the distribution module',\n handler: routeDistributionQuery,\n subcommands: [\n {\n name: 'rewards',\n description: 'Query distribution rewards for a delegator',\n },\n { name: 'commission', description: 'Query validator commission' },\n { name: 'community-pool', description: 'Query community pool coins' },\n { name: 'params', description: 'Query distribution parameters' },\n {\n name: 'validator-outstanding-rewards',\n description: 'Query validator outstanding rewards',\n },\n { name: 'slashes', description: 'Query slashes for a validator' },\n {\n name: 'delegator-validators',\n description: 'Query validators for a delegator',\n },\n {\n name: 'delegator-withdraw-address',\n description: 'Query delegator withdraw address',\n },\n ],\n },\n gov: {\n description: 'Querying commands for the governance module',\n handler: routeGovQuery,\n subcommands: [\n { name: 'proposal', description: 'Query a proposal by ID' },\n { name: 'proposals', description: 'Query all proposals' },\n { name: 'vote', description: 'Query a vote on a proposal' },\n { name: 'votes', description: 'Query all votes on a proposal' },\n { name: 'deposit', description: 'Query a deposit on a proposal' },\n { name: 'deposits', description: 'Query all deposits on a proposal' },\n { name: 'tally', description: 'Query tally of a proposal' },\n { name: 'params', description: 'Query governance parameters' },\n ],\n },\n auth: {\n description: 'Querying commands for the auth module',\n handler: routeAuthQuery,\n subcommands: [\n { name: 'account', description: 'Query account by address' },\n { name: 'accounts', description: 'Query all accounts' },\n { name: 'params', description: 'Query auth parameters' },\n { name: 'module-accounts', description: 'Query all module accounts' },\n {\n name: 'module-account-by-name',\n description: 'Query module account by name',\n },\n {\n name: 'address-bytes-to-string',\n description: 'Convert address bytes to string',\n },\n {\n name: 'address-string-to-bytes',\n description: 'Convert address string to bytes',\n },\n { name: 'bech32-prefix', description: 'Query bech32 prefix' },\n { name: 'account-info', description: 'Query account info' },\n ],\n },\n billing: {\n description: 'Querying commands for the Manifest billing module',\n handler: routeBillingQuery,\n subcommands: [\n { name: 'params', description: 'Query billing parameters' },\n { name: 'lease', description: 'Query a lease by UUID' },\n { name: 'leases', description: 'Query all leases' },\n {\n name: 'leases-by-tenant',\n description: 'Query leases by tenant address',\n },\n { name: 'leases-by-provider', description: 'Query leases by provider' },\n { name: 'leases-by-sku', description: 'Query leases by SKU UUID' },\n {\n name: 'credit-account',\n description: 'Query credit account for a tenant',\n },\n { name: 'credit-accounts', description: 'Query all credit accounts' },\n {\n name: 'credit-address',\n description: 'Query credit address for a tenant',\n },\n {\n name: 'withdrawable-amount',\n description: 'Query withdrawable amount for a lease',\n },\n {\n name: 'provider-withdrawable',\n description: 'Query withdrawable amount for a provider',\n },\n {\n name: 'credit-estimate',\n description: 'Query credit estimate for a tenant',\n },\n ],\n },\n sku: {\n description: 'Querying commands for the Manifest SKU module',\n handler: routeSkuQuery,\n subcommands: [\n { name: 'params', description: 'Query SKU module parameters' },\n {\n name: 'provider',\n description: 'Query a provider by UUID',\n args: '<provider-uuid>',\n },\n {\n name: 'providers',\n description: 'Query all providers',\n args: '[--active-only] [--limit N]',\n },\n { name: 'sku', description: 'Query a SKU by UUID', args: '<sku-uuid>' },\n {\n name: 'skus',\n description: 'Query all SKUs',\n args: '[--active-only] [--limit N]',\n },\n {\n name: 'skus-by-provider',\n description: 'Query SKUs by provider UUID',\n args: '<provider-uuid> [--active-only] [--limit N]',\n },\n {\n name: 'provider-by-address',\n description: 'Query providers by address',\n args: '<address> [--active-only] [--limit N]',\n },\n ],\n },\n group: {\n description: 'Querying commands for the group module',\n handler: routeGroupQuery,\n subcommands: [\n {\n name: 'group-info',\n description: 'Query group info by ID',\n args: '<group-id>',\n },\n {\n name: 'group-policy-info',\n description: 'Query group policy info by address',\n args: '<group-policy-address>',\n },\n {\n name: 'group-members',\n description: 'Query group members',\n args: '<group-id> [--limit N]',\n },\n {\n name: 'groups-by-admin',\n description: 'Query groups by admin address',\n args: '<admin-address> [--limit N]',\n },\n {\n name: 'group-policies-by-group',\n description: 'Query group policies by group ID',\n args: '<group-id> [--limit N]',\n },\n {\n name: 'group-policies-by-admin',\n description: 'Query group policies by admin address',\n args: '<admin-address> [--limit N]',\n },\n {\n name: 'proposal',\n description: 'Query a group proposal by ID',\n args: '<proposal-id>',\n },\n {\n name: 'proposals-by-group-policy',\n description: 'Query proposals by group policy address',\n args: '<group-policy-address> [--limit N]',\n },\n {\n name: 'vote',\n description: 'Query a vote by proposal ID and voter',\n args: '<proposal-id> <voter-address>',\n },\n {\n name: 'votes-by-proposal',\n description: 'Query votes by proposal ID',\n args: '<proposal-id> [--limit N]',\n },\n {\n name: 'votes-by-voter',\n description: 'Query votes by voter address',\n args: '<voter-address> [--limit N]',\n },\n {\n name: 'groups-by-member',\n description: 'Query groups by member address',\n args: '<member-address> [--limit N]',\n },\n {\n name: 'tally',\n description: 'Query tally result for a proposal',\n args: '<proposal-id>',\n },\n { name: 'groups', description: 'Query all groups', args: '[--limit N]' },\n ],\n },\n wasm: {\n description: 'Querying commands for the CosmWasm wasm module',\n handler: routeWasmQuery,\n subcommands: [\n {\n name: 'contract-info',\n description: 'Query contract info by address',\n args: '<address>',\n },\n {\n name: 'contract-history',\n description: 'Query contract code history',\n args: '<address> [--limit N]',\n },\n {\n name: 'contracts-by-code',\n description: 'Query contracts by code ID',\n args: '<code_id> [--limit N]',\n },\n {\n name: 'all-contract-state',\n description: 'Query all key-value pairs in contract state',\n args: '<address> [--limit N]',\n },\n {\n name: 'raw-contract-state',\n description: 'Query raw contract state by hex-encoded key',\n args: '<address> <query_data_hex>',\n },\n {\n name: 'smart-contract-state',\n description: 'Execute a smart query against a contract',\n args: '<address> <query_json>',\n },\n {\n name: 'code',\n description: 'Query code info and data by code ID',\n args: '<code_id>',\n },\n {\n name: 'codes',\n description: 'Query all stored wasm codes',\n args: '[--limit N]',\n },\n {\n name: 'code-info',\n description: 'Query code metadata by code ID',\n args: '<code_id>',\n },\n {\n name: 'pinned-codes',\n description: 'Query pinned code IDs',\n args: '[--limit N]',\n },\n { name: 'params', description: 'Query wasm module parameters' },\n {\n name: 'contracts-by-creator',\n description: 'Query contracts by creator address',\n args: '<creator_address> [--limit N]',\n },\n {\n name: 'wasm-limits-config',\n description: 'Query wasm limits configuration',\n },\n {\n name: 'build-address',\n description:\n 'Compute contract address from code hash, creator, and salt',\n args: '<code_hash> <creator_address> <salt>',\n },\n ],\n },\n};\n\n/**\n * Transaction modules registry\n * Each module includes metadata and its handler function\n */\nconst TX_MODULES: TxModuleRegistry = {\n bank: {\n description: 'Bank transaction subcommands',\n handler: routeBankTransaction,\n msgBuilder: buildBankMessages,\n subcommands: [\n {\n name: 'send',\n description: 'Send tokens to another account',\n args: '<to-address> <amount> (e.g., manifest1abc... 1000000umfx)',\n },\n {\n name: 'multi-send',\n description: 'Send tokens to multiple accounts',\n args: '<to-address:amount>... (e.g., manifest1a:1000umfx manifest1b:2000umfx)',\n },\n ],\n },\n staking: {\n description: 'Staking transaction subcommands',\n handler: routeStakingTransaction,\n msgBuilder: buildStakingMessages,\n subcommands: [\n { name: 'delegate', description: 'Delegate tokens to a validator' },\n { name: 'unbond', description: 'Unbond tokens from a validator' },\n {\n name: 'undelegate',\n description: 'Unbond tokens from a validator (alias for unbond)',\n },\n {\n name: 'redelegate',\n description: 'Redelegate tokens from one validator to another',\n },\n ],\n },\n distribution: {\n description: 'Distribution transaction subcommands',\n handler: routeDistributionTransaction,\n msgBuilder: buildDistributionMessages,\n subcommands: [\n {\n name: 'withdraw-rewards',\n description: 'Withdraw rewards from a validator',\n },\n { name: 'set-withdraw-addr', description: 'Set withdraw address' },\n { name: 'fund-community-pool', description: 'Fund the community pool' },\n ],\n },\n gov: {\n description: 'Governance transaction subcommands',\n handler: routeGovTransaction,\n msgBuilder: buildGovMessages,\n subcommands: [\n { name: 'vote', description: 'Vote on a proposal' },\n { name: 'weighted-vote', description: 'Weighted vote on a proposal' },\n { name: 'deposit', description: 'Deposit tokens for a proposal' },\n ],\n },\n billing: {\n description: 'Manifest billing transaction subcommands',\n handler: routeBillingTransaction,\n msgBuilder: buildBillingMessages,\n subcommands: [\n {\n name: 'fund-credit',\n description: 'Fund credit for a tenant',\n args: '<tenant-address> <amount> (e.g., manifest1abc... 1000000umfx)',\n },\n {\n name: 'create-lease',\n description: 'Create a new lease',\n args: '[--meta-hash <hex>] <sku-uuid:quantity[:service-name]>... (e.g., sku-123:1 or sku-123:1:web sku-123:1:db)',\n },\n {\n name: 'close-lease',\n description: 'Close one or more leases',\n args: '[--reason <text>] <lease-uuid>... (e.g., lease-123 lease-456)',\n },\n {\n name: 'withdraw',\n description: 'Withdraw earnings from leases',\n args: '<lease-uuid>... OR --provider <provider-uuid> [--limit <1-100>]',\n },\n {\n name: 'create-lease-for-tenant',\n description: 'Create a lease on behalf of a tenant',\n args: '<tenant-address> [--meta-hash <hex>] <sku-uuid:quantity[:service-name]>...',\n },\n {\n name: 'acknowledge-lease',\n description: 'Acknowledge one or more pending leases',\n args: '<lease-uuid>...',\n },\n {\n name: 'reject-lease',\n description: 'Reject one or more pending leases',\n args: '[--reason <text>] <lease-uuid>...',\n },\n {\n name: 'cancel-lease',\n description: 'Cancel one or more pending leases',\n args: '<lease-uuid>...',\n },\n {\n name: 'update-params',\n description: 'Update billing module parameters (governance)',\n args: '<max-leases-per-tenant> <max-items-per-lease> <min-lease-duration> <max-pending-leases-per-tenant> <pending-timeout> [<allowed-address>...]',\n },\n ],\n },\n manifest: {\n description: 'Manifest module transaction subcommands',\n handler: routeManifestTransaction,\n msgBuilder: buildManifestMessages,\n subcommands: [\n { name: 'payout', description: 'Execute a payout to multiple addresses' },\n { name: 'burn-held-balance', description: 'Burn held balance' },\n ],\n },\n sku: {\n description: 'Manifest SKU module transaction subcommands',\n handler: routeSkuTransaction,\n msgBuilder: buildSkuMessages,\n subcommands: [\n {\n name: 'create-provider',\n description: 'Create a new provider',\n args: '<address> <payout-address> <api-url> [--meta-hash <hex>]',\n },\n {\n name: 'update-provider',\n description: 'Update an existing provider',\n args: '<provider-uuid> <address> <payout-address> <api-url> [--meta-hash <hex>] [--active <true|false>]',\n },\n {\n name: 'deactivate-provider',\n description: 'Deactivate a provider',\n args: '<provider-uuid>',\n },\n {\n name: 'create-sku',\n description: 'Create a new SKU',\n args: '<provider-uuid> <name> <unit (per-hour|per-day)> <base-price> [--meta-hash <hex>]',\n },\n {\n name: 'update-sku',\n description: 'Update an existing SKU',\n args: '<sku-uuid> <provider-uuid> <name> <unit (per-hour|per-day)> <base-price> [--meta-hash <hex>] [--active <true|false>]',\n },\n {\n name: 'deactivate-sku',\n description: 'Deactivate a SKU',\n args: '<sku-uuid>',\n },\n {\n name: 'update-params',\n description: 'Update SKU module parameters (governance)',\n args: '<allowed-address>...',\n },\n ],\n },\n group: {\n description: 'Group module transaction subcommands',\n handler: routeGroupTransaction,\n msgBuilder: buildGroupMessages,\n subcommands: [\n {\n name: 'create-group',\n description: 'Create a new group',\n args: '<metadata> <address:weight>...',\n },\n {\n name: 'update-group-members',\n description: 'Update group members',\n args: '<group-id> <address:weight>...',\n },\n {\n name: 'update-group-admin',\n description: 'Update group admin',\n args: '<group-id> <new-admin-address>',\n },\n {\n name: 'update-group-metadata',\n description: 'Update group metadata',\n args: '<group-id> <metadata>',\n },\n {\n name: 'create-group-policy',\n description: 'Create a group policy',\n args: '<group-id> <metadata> <policy-type> <threshold-or-pct> <voting-period-secs> <min-execution-period-secs>',\n },\n {\n name: 'update-group-policy-admin',\n description: 'Update group policy admin',\n args: '<group-policy-address> <new-admin-address>',\n },\n {\n name: 'create-group-with-policy',\n description: 'Create a group with policy',\n args: '<group-metadata> <group-policy-metadata> <policy-type> <threshold-or-pct> <voting-period-secs> <min-execution-period-secs> [--group-policy-as-admin] <address:weight>...',\n },\n {\n name: 'update-group-policy-decision-policy',\n description: 'Update group policy decision policy',\n args: '<group-policy-address> <policy-type> <threshold-or-pct> <voting-period-secs> <min-execution-period-secs>',\n },\n {\n name: 'update-group-policy-metadata',\n description: 'Update group policy metadata',\n args: '<group-policy-address> <metadata>',\n },\n {\n name: 'submit-proposal',\n description: 'Submit a group proposal',\n args: '<group-policy-address> <title> <summary> [--exec try] [--metadata <text>] [<message-json>...]',\n },\n {\n name: 'withdraw-proposal',\n description: 'Withdraw a group proposal',\n args: '<proposal-id>',\n },\n {\n name: 'vote',\n description: 'Vote on a group proposal',\n args: '<proposal-id> <option (yes|no|abstain|no_with_veto)> [--metadata <text>] [--exec try]',\n },\n {\n name: 'exec',\n description: 'Execute a passed group proposal',\n args: '<proposal-id>',\n },\n { name: 'leave-group', description: 'Leave a group', args: '<group-id>' },\n ],\n },\n wasm: {\n description: 'CosmWasm wasm transaction subcommands',\n handler: routeWasmTransaction,\n msgBuilder: buildWasmMessages,\n subcommands: [\n {\n name: 'store-code',\n description: 'Upload wasm contract code (base64-encoded)',\n args: '<wasm_bytes_base64> [--instantiate-permission everybody|nobody|addr1,addr2] [--memo <text>]',\n },\n {\n name: 'instantiate',\n description: 'Instantiate a contract from a code ID',\n args: '<code_id> <json_msg> <label> [--admin <addr>] [--funds <number><denom>[,<number><denom>...]] [--memo <text>]',\n },\n {\n name: 'instantiate2',\n description: 'Instantiate a contract with a predictable address',\n args: '<code_id> <json_msg> <label> <salt> [--admin <addr>] [--funds <number><denom>[,<number><denom>...]] [--memo <text>]',\n },\n {\n name: 'execute',\n description: 'Execute a smart contract',\n args: '<contract_address> <json_msg> [--funds <number><denom>[,<number><denom>...]] [--memo <text>]',\n },\n {\n name: 'migrate',\n description: 'Migrate a contract to a new code version',\n args: '<contract_address> <new_code_id> <json_msg> [--memo <text>]',\n },\n {\n name: 'update-admin',\n description: 'Update the admin of a contract',\n args: '<contract_address> <new_admin> [--memo <text>]',\n },\n {\n name: 'clear-admin',\n description: 'Remove the admin of a contract',\n args: '<contract_address> [--memo <text>]',\n },\n ],\n },\n};\n\n/**\n * Get all available query and transaction modules\n */\nexport function getAvailableModules(): AvailableModules {\n const queryModules: ModuleInfo[] = Object.entries(QUERY_MODULES).map(\n ([name, info]) => ({\n name,\n description: info.description,\n }),\n );\n\n const txModules: ModuleInfo[] = Object.entries(TX_MODULES).map(\n ([name, info]) => ({\n name,\n description: info.description,\n }),\n );\n\n return {\n queryModules,\n txModules,\n };\n}\n\n/**\n * Get available subcommands for a specific module\n */\nexport function getModuleSubcommands(\n type: 'query' | 'tx',\n module: string,\n): ModuleInfo[] {\n const registry = type === 'query' ? QUERY_MODULES : TX_MODULES;\n const moduleInfo = registry[module];\n\n if (!moduleInfo) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.UNKNOWN_MODULE,\n `Unknown ${type} module: ${module}`,\n { availableModules: Object.keys(registry) },\n );\n }\n\n return moduleInfo.subcommands.map((sub) => ({\n name: sub.name,\n description: sub.description,\n args: sub.args,\n }));\n}\n\n/**\n * Check if a module/subcommand combination is supported\n */\nexport function isSubcommandSupported(\n type: 'query' | 'tx',\n module: string,\n subcommand: string,\n): boolean {\n const registry = type === 'query' ? QUERY_MODULES : TX_MODULES;\n const moduleInfo = registry[module];\n\n if (!moduleInfo) {\n return false;\n }\n\n return moduleInfo.subcommands.some((s) => s.name === subcommand);\n}\n\n/**\n * Get usage help for a specific subcommand\n * Returns the args string if available, or undefined\n */\nexport function getSubcommandUsage(\n type: 'query' | 'tx',\n module: string,\n subcommand: string,\n): string | undefined {\n const registry = type === 'query' ? QUERY_MODULES : TX_MODULES;\n const moduleInfo = registry[module];\n\n if (!moduleInfo) {\n return undefined;\n }\n\n const sub = moduleInfo.subcommands.find((s) => s.name === subcommand);\n return sub?.args;\n}\n\n/**\n * Get supported modules list\n */\nexport function getSupportedModules(): {\n query: { [module: string]: string[] };\n tx: { [module: string]: string[] };\n} {\n const result = {\n query: {} as { [module: string]: string[] },\n tx: {} as { [module: string]: string[] },\n };\n\n for (const [module, info] of Object.entries(QUERY_MODULES)) {\n result.query[module] = info.subcommands.map((s) => s.name);\n }\n\n for (const [module, info] of Object.entries(TX_MODULES)) {\n result.tx[module] = info.subcommands.map((s) => s.name);\n }\n\n return result;\n}\n\n/**\n * Get the handler function for a query module\n * @throws ManifestMCPError if module is not found\n */\nexport function getQueryHandler(module: string): QueryHandler {\n const moduleInfo = QUERY_MODULES[module];\n if (!moduleInfo) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.UNKNOWN_MODULE,\n `Unknown query module: ${module}`,\n { availableModules: Object.keys(QUERY_MODULES) },\n );\n }\n return moduleInfo.handler;\n}\n\n/**\n * Get the handler function for a transaction module\n * @throws ManifestMCPError if module is not found\n */\nexport function getTxHandler(module: string): TxHandler {\n const moduleInfo = TX_MODULES[module];\n if (!moduleInfo) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.UNKNOWN_MODULE,\n `Unknown tx module: ${module}`,\n { availableModules: Object.keys(TX_MODULES) },\n );\n }\n return moduleInfo.handler;\n}\n\n/**\n * Get the message builder function for a transaction module\n * @throws ManifestMCPError if module is not found\n */\nexport function getTxMsgBuilder(module: string): TxMsgBuilder {\n const moduleInfo = TX_MODULES[module];\n if (!moduleInfo) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.UNKNOWN_MODULE,\n `Unknown tx module: ${module}`,\n { availableModules: Object.keys(TX_MODULES) },\n );\n }\n return moduleInfo.msgBuilder;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FA,SAAgB,2BACd,MACA,QACA,YACO;CAGP,MAAM,wBAFW,SAAS,UAAU,gBAAgB,YACxB,SACa,YAAY,KAAK,MAAM,EAAE,KAAK,IAAI,EAAE;AAE7E,OAAM,IAAI,iBACR,SAAS,UACL,qBAAqB,oBACrB,qBAAqB,gBACzB,eAAe,OAAO,GAAG,SAAS,UAAU,UAAU,cAAc,eAAe,cACnF,EAAE,sBAAsB,CACzB;;;;;;AAmCH,MAAM,gBAAqC;CACzC,MAAM;EACJ,aAAa;EACb,SAAS;EACT,aAAa;GACX;IACE,MAAM;IACN,aAAa;IACd;GACD;IAAE,MAAM;IAAY,aAAa;IAAqC;GACtE;IACE,MAAM;IACN,aAAa;IACd;GACD;IAAE,MAAM;IAAgB,aAAa;IAAoC;GACzE;IACE,MAAM;IACN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;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACF;EACF;CACD,OAAO;EACL,aAAa;EACb,SAAS;EACT,aAAa;GACX;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IAAE,MAAM;IAAU,aAAa;IAAoB,MAAM;IAAe;GACzE;EACF;CACD,MAAM;EACJ,aAAa;EACb,SAAS;EACT,aAAa;GACX;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IAAE,MAAM;IAAU,aAAa;IAAgC;GAC/D;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACd;GACD;IACE,MAAM;IACN,aACE;IACF,MAAM;IACP;GACF;EACF;CACF;;;;;AAMD,MAAM,aAA+B;CACnC,MAAM;EACJ,aAAa;EACb,SAAS;EACT,YAAY;EACZ,aAAa,CACX;GACE,MAAM;GACN,aAAa;GACb,MAAM;GACP,EACD;GACE,MAAM;GACN,aAAa;GACb,MAAM;GACP,CACF;EACF;CACD,SAAS;EACP,aAAa;EACb,SAAS;EACT,YAAY;EACZ,aAAa;GACX;IAAE,MAAM;IAAY,aAAa;IAAkC;GACnE;IAAE,MAAM;IAAU,aAAa;IAAkC;GACjE;IACE,MAAM;IACN,aAAa;IACd;GACD;IACE,MAAM;IACN,aAAa;IACd;GACF;EACF;CACD,cAAc;EACZ,aAAa;EACb,SAAS;EACT,YAAY;EACZ,aAAa;GACX;IACE,MAAM;IACN,aAAa;IACd;GACD;IAAE,MAAM;IAAqB,aAAa;IAAwB;GAClE;IAAE,MAAM;IAAuB,aAAa;IAA2B;GACxE;EACF;CACD,KAAK;EACH,aAAa;EACb,SAAS;EACT,YAAY;EACZ,aAAa;GACX;IAAE,MAAM;IAAQ,aAAa;IAAsB;GACnD;IAAE,MAAM;IAAiB,aAAa;IAA+B;GACrE;IAAE,MAAM;IAAW,aAAa;IAAiC;GAClE;EACF;CACD,SAAS;EACP,aAAa;EACb,SAAS;EACT,YAAY;EACZ,aAAa;GACX;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACF;EACF;CACD,UAAU;EACR,aAAa;EACb,SAAS;EACT,YAAY;EACZ,aAAa,CACX;GAAE,MAAM;GAAU,aAAa;GAA0C,EACzE;GAAE,MAAM;GAAqB,aAAa;GAAqB,CAChE;EACF;CACD,KAAK;EACH,aAAa;EACb,SAAS;EACT,YAAY;EACZ,aAAa;GACX;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACF;EACF;CACD,OAAO;EACL,aAAa;EACb,SAAS;EACT,YAAY;EACZ,aAAa;GACX;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IAAE,MAAM;IAAe,aAAa;IAAiB,MAAM;IA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,YAAY,MAAM,MAAM,EAAE,SAAS,WAAW,EACzD;;;;;AAMd,SAAgB,sBAGd;CACA,MAAM,SAAS;EACb,OAAO,EAAE;EACT,IAAI,EAAE;EACP;AAED,MAAK,MAAM,CAAC,QAAQ,SAAS,OAAO,QAAQ,cAAc,CACxD,QAAO,MAAM,UAAU,KAAK,YAAY,KAAK,MAAM,EAAE,KAAK;AAG5D,MAAK,MAAM,CAAC,QAAQ,SAAS,OAAO,QAAQ,WAAW,CACrD,QAAO,GAAG,UAAU,KAAK,YAAY,KAAK,MAAM,EAAE,KAAK;AAGzD,QAAO;;;;;;AAOT,SAAgB,gBAAgB,QAA8B;CAC5D,MAAM,aAAa,cAAc;AACjC,KAAI,CAAC,WACH,OAAM,IAAI,iBACR,qBAAqB,gBACrB,yBAAyB,UACzB,EAAE,kBAAkB,OAAO,KAAK,cAAc,EAAE,CACjD;AAEH,QAAO,WAAW;;;;;;AAOpB,SAAgB,aAAa,QAA2B;CACtD,MAAM,aAAa,WAAW;AAC9B,KAAI,CAAC,WACH,OAAM,IAAI,iBACR,qBAAqB,gBACrB,sBAAsB,UACtB,EAAE,kBAAkB,OAAO,KAAK,WAAW,EAAE,CAC9C;AAEH,QAAO,WAAW;;;;;;AAOpB,SAAgB,gBAAgB,QAA8B;CAC5D,MAAM,aAAa,WAAW;AAC9B,KAAI,CAAC,WACH,OAAM,IAAI,iBACR,qBAAqB,gBACrB,sBAAsB,UACtB,EAAE,kBAAkB,OAAO,KAAK,WAAW,EAAE,CAC9C;AAEH,QAAO,WAAW"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { CosmosTxResult, TxOptions } from "../types.js";
|
|
1
|
+
import { BuiltMessages, CosmosTxResult, TxOptions } from "../types.js";
|
|
2
2
|
import { SigningStargateClient } from "@cosmjs/stargate";
|
|
3
3
|
|
|
4
4
|
//#region src/transactions/bank.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Build messages for a bank transaction subcommand (no signing/broadcasting).
|
|
7
|
+
*/
|
|
8
|
+
declare function buildBankMessages(senderAddress: string, subcommand: string, args: string[]): BuiltMessages;
|
|
5
9
|
/**
|
|
6
10
|
* Route bank transaction to appropriate handler
|
|
7
11
|
*/
|
|
8
12
|
declare function routeBankTransaction(client: SigningStargateClient, senderAddress: string, subcommand: string, args: string[], waitForConfirmation: boolean, options?: TxOptions): Promise<CosmosTxResult>;
|
|
9
13
|
//#endregion
|
|
10
|
-
export { routeBankTransaction };
|
|
14
|
+
export { buildBankMessages, routeBankTransaction };
|
|
11
15
|
//# sourceMappingURL=bank.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bank.d.ts","names":[],"sources":["../../src/transactions/bank.ts"],"mappings":";;;;;;AAsBA;
|
|
1
|
+
{"version":3,"file":"bank.d.ts","names":[],"sources":["../../src/transactions/bank.ts"],"mappings":";;;;;;AAsBA;iBAAgB,iBAAA,CACd,aAAA,UACA,UAAA,UACA,IAAA,aACC,aAAA;;;;iBAqFmB,oBAAA,CACpB,MAAA,EAAQ,qBAAA,EACR,aAAA,UACA,UAAA,UACA,IAAA,YACA,mBAAA,WACA,OAAA,GAAU,SAAA,GACT,OAAA,CAAQ,cAAA"}
|