@manifest-network/manifest-mcp-core 0.6.2 → 0.7.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/README.md +4 -1
- package/dist/__test-utils__/callTool.d.ts +1 -0
- package/dist/__test-utils__/callTool.d.ts.map +1 -1
- package/dist/__test-utils__/callTool.js.map +1 -1
- package/dist/client.d.ts +5 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +16 -5
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +4 -3
- package/dist/lcd-adapter.d.ts.map +1 -1
- package/dist/lcd-adapter.js +22 -3
- package/dist/lcd-adapter.js.map +1 -1
- package/dist/logger.d.ts +8 -3
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +12 -7
- package/dist/logger.js.map +1 -1
- package/dist/modules.d.ts.map +1 -1
- package/dist/modules.js +257 -0
- package/dist/modules.js.map +1 -1
- package/dist/queries/authz.d.ts +15 -0
- package/dist/queries/authz.d.ts.map +1 -0
- package/dist/queries/authz.js +62 -0
- package/dist/queries/authz.js.map +1 -0
- package/dist/queries/feegrant.d.ts +15 -0
- package/dist/queries/feegrant.d.ts.map +1 -0
- package/dist/queries/feegrant.js +52 -0
- package/dist/queries/feegrant.js.map +1 -0
- package/dist/queries/ibc-transfer.d.ts +13 -0
- package/dist/queries/ibc-transfer.d.ts.map +1 -0
- package/dist/queries/ibc-transfer.js +30 -0
- package/dist/queries/ibc-transfer.js.map +1 -0
- package/dist/queries/index.d.ts +7 -1
- package/dist/queries/index.js +7 -1
- package/dist/queries/mint.d.ts +13 -0
- package/dist/queries/mint.d.ts.map +1 -0
- package/dist/queries/mint.js +28 -0
- package/dist/queries/mint.js.map +1 -0
- package/dist/queries/poa.d.ts +13 -0
- package/dist/queries/poa.d.ts.map +1 -0
- package/dist/queries/poa.js +23 -0
- package/dist/queries/poa.js.map +1 -0
- package/dist/queries/tokenfactory.d.ts +13 -0
- package/dist/queries/tokenfactory.d.ts.map +1 -0
- package/dist/queries/tokenfactory.js +32 -0
- package/dist/queries/tokenfactory.js.map +1 -0
- package/dist/retry.d.ts.map +1 -1
- package/dist/retry.js +1 -4
- package/dist/retry.js.map +1 -1
- package/dist/server-utils.d.ts +15 -1
- package/dist/server-utils.d.ts.map +1 -1
- package/dist/server-utils.js +25 -1
- package/dist/server-utils.js.map +1 -1
- package/dist/tool-metadata.d.ts +93 -0
- package/dist/tool-metadata.d.ts.map +1 -0
- package/dist/tool-metadata.js +93 -0
- package/dist/tool-metadata.js.map +1 -0
- package/dist/transactions/authz.d.ts +15 -0
- package/dist/transactions/authz.d.ts.map +1 -0
- package/dist/transactions/authz.js +121 -0
- package/dist/transactions/authz.js.map +1 -0
- package/dist/transactions/feegrant.d.ts +15 -0
- package/dist/transactions/feegrant.d.ts.map +1 -0
- package/dist/transactions/feegrant.js +75 -0
- package/dist/transactions/feegrant.js.map +1 -0
- package/dist/transactions/ibc-transfer.d.ts +15 -0
- package/dist/transactions/ibc-transfer.d.ts.map +1 -0
- package/dist/transactions/ibc-transfer.js +94 -0
- package/dist/transactions/ibc-transfer.js.map +1 -0
- package/dist/transactions/index.d.ts +4 -1
- package/dist/transactions/index.js +4 -1
- package/dist/transactions/json-schemas.d.ts +78 -0
- package/dist/transactions/json-schemas.d.ts.map +1 -0
- package/dist/transactions/json-schemas.js +134 -0
- package/dist/transactions/json-schemas.js.map +1 -0
- package/dist/transactions/poa.d.ts +19 -0
- package/dist/transactions/poa.d.ts.map +1 -0
- package/dist/transactions/poa.js +130 -0
- package/dist/transactions/poa.js.map +1 -0
- package/dist/transactions/tokenfactory.d.ts +15 -0
- package/dist/transactions/tokenfactory.d.ts.map +1 -0
- package/dist/transactions/tokenfactory.js +138 -0
- package/dist/transactions/tokenfactory.js.map +1 -0
- package/dist/transactions/utils.d.ts +9 -1
- package/dist/transactions/utils.d.ts.map +1 -1
- package/dist/transactions/utils.js +17 -1
- package/dist/transactions/utils.js.map +1 -1
- package/dist/types.d.ts +64 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ npm install @manifest-network/manifest-mcp-core
|
|
|
17
17
|
- **On-chain tool functions** (`tools/`) -- `getBalance`, `fundCredits`, `stopApp` (used by the lease package)
|
|
18
18
|
- **Server utilities** (`server-utils.ts`) -- `withErrorHandling`, `jsonResponse`, `bigIntReplacer`, `sanitizeForLogging`
|
|
19
19
|
- **Wallet providers** (`wallet/`) -- `MnemonicWalletProvider` (BIP-39), `signArbitraryWithAmino` (ADR-036)
|
|
20
|
-
- **Logger** (`logger.ts`) -- Leveled logger (stderr output
|
|
20
|
+
- **Logger** (`logger.ts`) -- Leveled logger (stderr output; defaults to `warn`, configurable via `logger.setLevel()`; the node package's bootstrap reads `LOG_LEVEL` and applies it)
|
|
21
21
|
- **Retry** (`retry.ts`) -- Exponential backoff with transient/permanent error classification
|
|
22
22
|
- **Validation** (`validation.ts`) -- Input validation helpers (`requireString`, `requireUuid`, `parseArgs`, etc.)
|
|
23
23
|
|
|
@@ -33,6 +33,9 @@ npm install @manifest-network/manifest-mcp-core
|
|
|
33
33
|
| sku | yes | yes |
|
|
34
34
|
| group | yes | yes |
|
|
35
35
|
| wasm | yes | yes |
|
|
36
|
+
| poa | yes | yes |
|
|
37
|
+
| tokenfactory | yes | yes |
|
|
38
|
+
| ibc-transfer | yes | yes |
|
|
36
39
|
| auth | yes | -- |
|
|
37
40
|
| manifest | -- | yes |
|
|
38
41
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callTool.d.ts","names":[],"sources":["../../src/__test-utils__/callTool.ts"],"mappings":";;;;UAIiB,UAAA;EACf,OAAA,EAAS,KAAA;IAAQ,IAAA;IAAc,IAAA;EAAA;EAC/B,OAAA;AAAA;;;;;;;
|
|
1
|
+
{"version":3,"file":"callTool.d.ts","names":[],"sources":["../../src/__test-utils__/callTool.ts"],"mappings":";;;;UAIiB,UAAA;EACf,OAAA,EAAS,KAAA;IAAQ,IAAA;IAAc,IAAA;EAAA;EAC/B,OAAA;EACA,iBAAA,GAAoB,MAAA;AAAA;;;;;;;;AAiBtB;;;;;;;iBAAsB,QAAA,CACpB,MAAA,EAAQ,MAAA,EACR,QAAA,UACA,SAAA,GAAW,MAAA,mBACX,gBAAA,GAAkB,iBAAA,KACjB,OAAA,CAAQ,UAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callTool.js","names":[],"sources":["../../src/__test-utils__/callTool.ts"],"sourcesContent":["import { Client } from '@modelcontextprotocol/sdk/client/index.js';\nimport { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';\nimport type { Server } from '@modelcontextprotocol/sdk/server/index.js';\n\nexport interface ToolResult {\n content: Array<{ type: string; text: string }>;\n isError?: boolean;\n}\n\n/**\n * Shared test helper: connects an MCP client to a server via in-memory\n * transport, calls the given tool, then cleans up both transports.\n *\n * Cleanup always runs via the `finally` block: client and both transports\n * are closed, then removed from `activeTransports` to prevent double-close\n * in the caller's `afterEach`.\n *\n * @param server - The MCP `Server` instance (from `getServer()`)\n * @param toolName - Name of the tool to invoke\n * @param toolInput - Optional tool arguments\n * @param activeTransports - Optional mutable array; transports are added\n * before the call and removed after cleanup completes.\n */\nexport async function callTool(\n server: Server,\n toolName: string,\n toolInput: Record<string, unknown> = {},\n activeTransports: InMemoryTransport[] = [],\n): Promise<ToolResult> {\n const [clientTransport, serverTransport] =\n InMemoryTransport.createLinkedPair();\n activeTransports.push(clientTransport, serverTransport);\n\n const client = new Client({ name: 'test-client', version: '1.0.0' });\n\n try {\n await server.connect(serverTransport);\n await client.connect(clientTransport);\n\n return (await client.callTool({\n name: toolName,\n arguments: toolInput,\n })) as ToolResult;\n } finally {\n await client.close().catch(() => {});\n await clientTransport.close().catch(() => {});\n await serverTransport.close().catch(() => {});\n\n // Remove by identity so afterEach won't double-close\n for (const t of [clientTransport, serverTransport]) {\n const idx = activeTransports.indexOf(t);\n if (idx !== -1) activeTransports.splice(idx, 1);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"callTool.js","names":[],"sources":["../../src/__test-utils__/callTool.ts"],"sourcesContent":["import { Client } from '@modelcontextprotocol/sdk/client/index.js';\nimport { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';\nimport type { Server } from '@modelcontextprotocol/sdk/server/index.js';\n\nexport interface ToolResult {\n content: Array<{ type: string; text: string }>;\n isError?: boolean;\n structuredContent?: Record<string, unknown>;\n}\n\n/**\n * Shared test helper: connects an MCP client to a server via in-memory\n * transport, calls the given tool, then cleans up both transports.\n *\n * Cleanup always runs via the `finally` block: client and both transports\n * are closed, then removed from `activeTransports` to prevent double-close\n * in the caller's `afterEach`.\n *\n * @param server - The MCP `Server` instance (from `getServer()`)\n * @param toolName - Name of the tool to invoke\n * @param toolInput - Optional tool arguments\n * @param activeTransports - Optional mutable array; transports are added\n * before the call and removed after cleanup completes.\n */\nexport async function callTool(\n server: Server,\n toolName: string,\n toolInput: Record<string, unknown> = {},\n activeTransports: InMemoryTransport[] = [],\n): Promise<ToolResult> {\n const [clientTransport, serverTransport] =\n InMemoryTransport.createLinkedPair();\n activeTransports.push(clientTransport, serverTransport);\n\n const client = new Client({ name: 'test-client', version: '1.0.0' });\n\n try {\n await server.connect(serverTransport);\n await client.connect(clientTransport);\n\n return (await client.callTool({\n name: toolName,\n arguments: toolInput,\n })) as ToolResult;\n } finally {\n await client.close().catch(() => {});\n await clientTransport.close().catch(() => {});\n await serverTransport.close().catch(() => {});\n\n // Remove by identity so afterEach won't double-close\n for (const t of [clientTransport, serverTransport]) {\n const idx = activeTransports.indexOf(t);\n if (idx !== -1) activeTransports.splice(idx, 1);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAwBA,eAAsB,SACpB,QACA,UACA,YAAqC,EAAE,EACvC,mBAAwC,EAAE,EACrB;CACrB,MAAM,CAAC,iBAAiB,mBACtB,kBAAkB,kBAAkB;AACtC,kBAAiB,KAAK,iBAAiB,gBAAgB;CAEvD,MAAM,SAAS,IAAI,OAAO;EAAE,MAAM;EAAe,SAAS;EAAS,CAAC;AAEpE,KAAI;AACF,QAAM,OAAO,QAAQ,gBAAgB;AACrC,QAAM,OAAO,QAAQ,gBAAgB;AAErC,SAAQ,MAAM,OAAO,SAAS;GAC5B,MAAM;GACN,WAAW;GACZ,CAAC;WACM;AACR,QAAM,OAAO,OAAO,CAAC,YAAY,GAAG;AACpC,QAAM,gBAAgB,OAAO,CAAC,YAAY,GAAG;AAC7C,QAAM,gBAAgB,OAAO,CAAC,YAAY,GAAG;AAG7C,OAAK,MAAM,KAAK,CAAC,iBAAiB,gBAAgB,EAAE;GAClD,MAAM,MAAM,iBAAiB,QAAQ,EAAE;AACvC,OAAI,QAAQ,GAAI,kBAAiB,OAAO,KAAK,EAAE"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { ManifestMCPConfig, WalletProvider } from "./types.js";
|
|
2
2
|
import { SigningStargateClient } from "@cosmjs/stargate";
|
|
3
|
-
import { cosmwasm, liftedinit } from "@manifest-network/manifestjs";
|
|
3
|
+
import { cosmwasm, ibc, liftedinit, osmosis, strangelove_ventures } from "@manifest-network/manifestjs";
|
|
4
4
|
|
|
5
5
|
//#region src/client.d.ts
|
|
6
6
|
type LiftedinitQueryClient = Awaited<ReturnType<typeof liftedinit.ClientFactory.createRPCQueryClient>>;
|
|
7
7
|
type CosmwasmQueryClient = Awaited<ReturnType<typeof cosmwasm.ClientFactory.createRPCQueryClient>>;
|
|
8
|
-
type
|
|
8
|
+
type StrangeloveVenturesQueryClient = Awaited<ReturnType<typeof strangelove_ventures.ClientFactory.createRPCQueryClient>>;
|
|
9
|
+
type OsmosisQueryClient = Awaited<ReturnType<typeof osmosis.ClientFactory.createRPCQueryClient>>;
|
|
10
|
+
type IbcQueryClient = Awaited<ReturnType<typeof ibc.ClientFactory.createRPCQueryClient>>;
|
|
11
|
+
type ManifestQueryClient = LiftedinitQueryClient & Pick<CosmwasmQueryClient, 'cosmwasm'> & Pick<StrangeloveVenturesQueryClient, 'strangelove_ventures'> & Pick<OsmosisQueryClient, 'osmosis'> & Pick<IbcQueryClient, 'ibc'>;
|
|
9
12
|
/**
|
|
10
13
|
* Manages CosmJS client instances with lazy initialization and singleton pattern
|
|
11
14
|
*/
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","names":[],"sources":["../src/client.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../src/client.ts"],"mappings":";;;;;KA4CK,qBAAA,GAAwB,OAAA,CAC3B,UAAA,QAAkB,UAAA,CAAW,aAAA,CAAc,oBAAA;AAAA,KAExC,mBAAA,GAAsB,OAAA,CACzB,UAAA,QAAkB,QAAA,CAAW,aAAA,CAAc,oBAAA;AAAA,KAExC,8BAAA,GAAiC,OAAA,CACpC,UAAA,QAAkB,oBAAA,CAAsB,aAAA,CAAc,oBAAA;AAAA,KAEnD,kBAAA,GAAqB,OAAA,CACxB,UAAA,QAAkB,OAAA,CAAU,aAAA,CAAc,oBAAA;AAAA,KAEvC,cAAA,GAAiB,OAAA,CACpB,UAAA,QAAkB,GAAA,CAAM,aAAA,CAAc,oBAAA;AAAA,KAE5B,mBAAA,GAAsB,qBAAA,GAChC,IAAA,CAAK,mBAAA,gBACL,IAAA,CAAK,8BAAA,4BACL,IAAA,CAAK,kBAAA,eACL,IAAA,CAAK,cAAA;;;;cAiDM,mBAAA;EAAA,eACI,SAAA;EAAA,QAEP,MAAA;EAAA,QACA,cAAA;EAAA,QACA,WAAA;EAAA,QACA,aAAA;EAAA,QACA,WAAA;EAAA,QAGA,kBAAA;EAAA,QACA,oBAAA;EAAA,QAED,WAAA,CAAA;;;;;;;;SAuBA,WAAA,CACL,MAAA,EAAQ,iBAAA,EACR,cAAA,EAAgB,cAAA,GACf,mBAAA;EAvGe;;;;EAAA,OA2JX,cAAA,CAAA;EAzJJ;;;;;EAqKG,cAAA,CAAA,GAAkB,OAAA,CAAQ,mBAAA;EArKW;;;;;EA4QrC,gBAAA,CAAA,GAAoB,OAAA,CAAQ,qBAAA;EA3QoB;;;EAkXhD,UAAA,CAAA,GAAc,OAAA;EAhXC;;;EAuXrB,SAAA,CAAA,GAAa,iBAAA;EAvXW;;;;EA+XlB,gBAAA,CAAA,GAAoB,OAAA;EA9XR;;;;;EAuYlB,UAAA,CAAA;AAAA"}
|
package/dist/client.js
CHANGED
|
@@ -5,7 +5,7 @@ import { logger } from "./logger.js";
|
|
|
5
5
|
import { createLCDQueryClient } from "./lcd-adapter.js";
|
|
6
6
|
import { Registry } from "@cosmjs/proto-signing";
|
|
7
7
|
import { AminoTypes, GasPrice, SigningStargateClient } from "@cosmjs/stargate";
|
|
8
|
-
import { cosmosAminoConverters, cosmosProtoRegistry, cosmwasm, cosmwasmAminoConverters, cosmwasmProtoRegistry, liftedinit, liftedinitAminoConverters, liftedinitProtoRegistry, osmosisAminoConverters, osmosisProtoRegistry, strangeloveVenturesAminoConverters, strangeloveVenturesProtoRegistry } from "@manifest-network/manifestjs";
|
|
8
|
+
import { cosmosAminoConverters, cosmosProtoRegistry, cosmwasm, cosmwasmAminoConverters, cosmwasmProtoRegistry, ibc, ibcAminoConverters, ibcProtoRegistry, liftedinit, liftedinitAminoConverters, liftedinitProtoRegistry, osmosis, osmosisAminoConverters, osmosisProtoRegistry, strangeloveVenturesAminoConverters, strangeloveVenturesProtoRegistry, strangelove_ventures } from "@manifest-network/manifestjs";
|
|
9
9
|
import { RateLimiter } from "limiter";
|
|
10
10
|
//#region src/client.ts
|
|
11
11
|
/** Default timeout for transaction broadcast (60 seconds) */
|
|
@@ -22,14 +22,16 @@ function getSigningManifestClientOptions() {
|
|
|
22
22
|
...liftedinitProtoRegistry,
|
|
23
23
|
...strangeloveVenturesProtoRegistry,
|
|
24
24
|
...osmosisProtoRegistry,
|
|
25
|
-
...cosmwasmProtoRegistry
|
|
25
|
+
...cosmwasmProtoRegistry,
|
|
26
|
+
...ibcProtoRegistry
|
|
26
27
|
]),
|
|
27
28
|
aminoTypes: new AminoTypes({
|
|
28
29
|
...cosmosAminoConverters,
|
|
29
30
|
...liftedinitAminoConverters,
|
|
30
31
|
...strangeloveVenturesAminoConverters,
|
|
31
32
|
...osmosisAminoConverters,
|
|
32
|
-
...cosmwasmAminoConverters
|
|
33
|
+
...cosmwasmAminoConverters,
|
|
34
|
+
...ibcAminoConverters
|
|
33
35
|
})
|
|
34
36
|
};
|
|
35
37
|
}
|
|
@@ -111,10 +113,19 @@ var CosmosClientManager = class CosmosClientManager {
|
|
|
111
113
|
operationName: "connect LCD query client"
|
|
112
114
|
});
|
|
113
115
|
else if (this.config.rpcUrl) client = await withRetry(async () => {
|
|
114
|
-
const [liftedinitClient, cosmwasmClient] = await Promise.all([
|
|
116
|
+
const [liftedinitClient, cosmwasmClient, strangeloveClient, osmosisClient, ibcClient] = await Promise.all([
|
|
117
|
+
liftedinit.ClientFactory.createRPCQueryClient({ rpcEndpoint: this.config.rpcUrl }),
|
|
118
|
+
cosmwasm.ClientFactory.createRPCQueryClient({ rpcEndpoint: this.config.rpcUrl }),
|
|
119
|
+
strangelove_ventures.ClientFactory.createRPCQueryClient({ rpcEndpoint: this.config.rpcUrl }),
|
|
120
|
+
osmosis.ClientFactory.createRPCQueryClient({ rpcEndpoint: this.config.rpcUrl }),
|
|
121
|
+
ibc.ClientFactory.createRPCQueryClient({ rpcEndpoint: this.config.rpcUrl })
|
|
122
|
+
]);
|
|
115
123
|
return {
|
|
116
124
|
...liftedinitClient,
|
|
117
|
-
cosmwasm: cosmwasmClient.cosmwasm
|
|
125
|
+
cosmwasm: cosmwasmClient.cosmwasm,
|
|
126
|
+
strangelove_ventures: strangeloveClient.strangelove_ventures,
|
|
127
|
+
osmosis: osmosisClient.osmosis,
|
|
128
|
+
ibc: ibcClient.ibc
|
|
118
129
|
};
|
|
119
130
|
}, {
|
|
120
131
|
config: this.config.retry,
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["cosmwasmNs"],"sources":["../src/client.ts"],"sourcesContent":["import { Registry } from '@cosmjs/proto-signing';\nimport {\n AminoTypes,\n GasPrice,\n type HttpEndpoint,\n SigningStargateClient,\n} from '@cosmjs/stargate';\nimport {\n cosmosAminoConverters,\n cosmosProtoRegistry,\n cosmwasmAminoConverters,\n cosmwasm as cosmwasmNs,\n cosmwasmProtoRegistry,\n liftedinit,\n liftedinitAminoConverters,\n liftedinitProtoRegistry,\n osmosisAminoConverters,\n osmosisProtoRegistry,\n strangeloveVenturesAminoConverters,\n strangeloveVenturesProtoRegistry,\n} from '@manifest-network/manifestjs';\nimport { RateLimiter } from 'limiter';\nimport {\n DEFAULT_GAS_MULTIPLIER,\n DEFAULT_REQUESTS_PER_SECOND,\n} from './config.js';\nimport { createLCDQueryClient } from './lcd-adapter.js';\nimport { logger } from './logger.js';\nimport { withRetry } from './retry.js';\nimport {\n type ManifestMCPConfig,\n ManifestMCPError,\n ManifestMCPErrorCode,\n type WalletProvider,\n} from './types.js';\n\n// Combined query client type: liftedinit modules (cosmos + billing/manifest/sku) + cosmwasm\n// Uses Pick to extract only the cosmwasm namespace, avoiding conflicts with overlapping cosmos types.\ntype LiftedinitQueryClient = Awaited<\n ReturnType<typeof liftedinit.ClientFactory.createRPCQueryClient>\n>;\ntype CosmwasmQueryClient = Awaited<\n ReturnType<typeof cosmwasmNs.ClientFactory.createRPCQueryClient>\n>;\nexport type ManifestQueryClient = LiftedinitQueryClient &\n Pick<CosmwasmQueryClient, 'cosmwasm'>;\n\n/**\n * Extract the registry type expected by SigningStargateClient.connectWithSigner.\n *\n * The Registry type from @cosmjs/proto-signing doesn't perfectly match the registry type\n * in SigningStargateClientOptions due to telescope-generated proto types. This type alias\n * extracts the expected registry type from the function signature to enable type-safe casting.\n */\ntype SigningClientRegistry = Parameters<\n typeof SigningStargateClient.connectWithSigner\n>[2] extends { registry?: infer R }\n ? R\n : never;\n\n/** Default timeout for transaction broadcast (60 seconds) */\nconst DEFAULT_BROADCAST_TIMEOUT_MS = 60_000;\n\n/** Default polling interval for transaction confirmation (3 seconds) */\nconst DEFAULT_BROADCAST_POLL_INTERVAL_MS = 3_000;\n\n/**\n * Get combined signing client options with all Manifest registries\n */\nfunction getSigningManifestClientOptions() {\n const registry = new Registry([\n ...cosmosProtoRegistry,\n ...liftedinitProtoRegistry,\n ...strangeloveVenturesProtoRegistry,\n ...osmosisProtoRegistry,\n ...cosmwasmProtoRegistry,\n ]);\n\n const aminoTypes = new AminoTypes({\n ...cosmosAminoConverters,\n ...liftedinitAminoConverters,\n ...strangeloveVenturesAminoConverters,\n ...osmosisAminoConverters,\n ...cosmwasmAminoConverters,\n });\n\n return { registry, aminoTypes };\n}\n\n/**\n * Manages CosmJS client instances with lazy initialization and singleton pattern\n */\nexport class CosmosClientManager {\n private static instances: Map<string, CosmosClientManager> = new Map();\n\n private config: ManifestMCPConfig;\n private walletProvider: WalletProvider;\n private queryClient: ManifestQueryClient | null = null;\n private signingClient: SigningStargateClient | null = null;\n private rateLimiter: RateLimiter;\n\n // Promises to prevent concurrent client initialization (lazy init race condition)\n private queryClientPromise: Promise<ManifestQueryClient> | null = null;\n private signingClientPromise: Promise<SigningStargateClient> | null = null;\n\n private constructor(\n config: ManifestMCPConfig,\n walletProvider: WalletProvider,\n ) {\n this.config = config;\n this.walletProvider = walletProvider;\n\n // Initialize rate limiter with configured or default requests per second\n const requestsPerSecond =\n config.rateLimit?.requestsPerSecond ?? DEFAULT_REQUESTS_PER_SECOND;\n this.rateLimiter = new RateLimiter({\n tokensPerInterval: requestsPerSecond,\n interval: 'second',\n });\n }\n\n /**\n * Get or create a singleton instance for the given config.\n * Instances are keyed by chainId:rpcUrl:restUrl. For existing instances:\n * - Config and walletProvider references are always updated\n * - Signing client is disconnected/recreated if gasPrice, gasMultiplier, or walletProvider changed\n * - Rate limiter is updated if requestsPerSecond changed (without affecting signing client)\n */\n static getInstance(\n config: ManifestMCPConfig,\n walletProvider: WalletProvider,\n ): CosmosClientManager {\n const parts = [config.chainId, config.rpcUrl ?? ''];\n if (config.restUrl) parts.push(config.restUrl);\n const key = parts.join(':');\n let instance = CosmosClientManager.instances.get(key);\n\n if (!instance) {\n instance = new CosmosClientManager(config, walletProvider);\n CosmosClientManager.instances.set(key, instance);\n } else {\n // Check what changed to determine what needs updating\n const signingClientAffected =\n instance.config.gasPrice !== config.gasPrice ||\n instance.config.gasMultiplier !== config.gasMultiplier ||\n instance.walletProvider !== walletProvider;\n\n const rateLimitChanged =\n instance.config.rateLimit?.requestsPerSecond !==\n config.rateLimit?.requestsPerSecond;\n\n // Always update config reference\n instance.config = config;\n instance.walletProvider = walletProvider;\n\n // Only invalidate signing client if fields it depends on changed\n if (signingClientAffected) {\n if (instance.signingClient) {\n instance.signingClient.disconnect();\n instance.signingClient = null;\n }\n // Also clear the promise to allow re-initialization with new config\n instance.signingClientPromise = null;\n }\n\n // Update rate limiter independently (doesn't affect signing client)\n if (rateLimitChanged) {\n const newRps =\n config.rateLimit?.requestsPerSecond ?? DEFAULT_REQUESTS_PER_SECOND;\n instance.rateLimiter = new RateLimiter({\n tokensPerInterval: newRps,\n interval: 'second',\n });\n }\n }\n\n return instance;\n }\n\n /**\n * Clear all cached instances (useful for testing or reconnection).\n * Disconnects signing clients and releases query client references before clearing.\n */\n static clearInstances(): void {\n for (const instance of CosmosClientManager.instances.values()) {\n instance.disconnect();\n }\n CosmosClientManager.instances.clear();\n }\n\n /**\n * Get the manifestjs RPC query client with all module extensions\n *\n * Automatically retries on transient connection failures with exponential backoff.\n */\n async getQueryClient(): Promise<ManifestQueryClient> {\n // Return cached client if available\n if (this.queryClient) {\n return this.queryClient;\n }\n\n // If initialization is already in progress, wait for it\n if (this.queryClientPromise) {\n return this.queryClientPromise;\n }\n\n // Start initialization and cache the promise to prevent concurrent init\n this.queryClientPromise = (async () => {\n // Capture reference to detect if superseded by disconnect/config change\n const thisInitPromise = this.queryClientPromise;\n try {\n let client: ManifestQueryClient;\n if (this.config.restUrl) {\n // Use LCD/REST for queries when restUrl is configured\n client = await withRetry(\n () => createLCDQueryClient(this.config.restUrl!),\n {\n config: this.config.retry,\n operationName: 'connect LCD query client',\n },\n );\n } else if (this.config.rpcUrl) {\n // Use RPC: merge liftedinit + cosmwasm namespaces into a single client\n client = await withRetry(\n async () => {\n const [liftedinitClient, cosmwasmClient] = await Promise.all([\n liftedinit.ClientFactory.createRPCQueryClient({\n rpcEndpoint: this.config.rpcUrl!,\n }),\n cosmwasmNs.ClientFactory.createRPCQueryClient({\n rpcEndpoint: this.config.rpcUrl!,\n }),\n ]);\n return {\n ...liftedinitClient,\n cosmwasm: cosmwasmClient.cosmwasm,\n } as ManifestQueryClient;\n },\n {\n config: this.config.retry,\n operationName: 'connect query client',\n },\n );\n } else {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.INVALID_CONFIG,\n 'Cannot create query client: neither restUrl nor rpcUrl is configured.',\n );\n }\n // Only store if this is still the active promise\n if (this.queryClientPromise === thisInitPromise) {\n this.queryClient = client;\n this.queryClientPromise = null;\n }\n return client;\n } catch (error) {\n // Clear promise on failure so retry is possible (only if still active)\n if (this.queryClientPromise === thisInitPromise) {\n this.queryClientPromise = null;\n }\n if (error instanceof ManifestMCPError) {\n throw error;\n }\n const endpoint = this.config.restUrl ?? this.config.rpcUrl;\n throw new ManifestMCPError(\n ManifestMCPErrorCode.RPC_CONNECTION_FAILED,\n `Failed to connect to ${this.config.restUrl ? 'REST' : 'RPC'} endpoint: ${error instanceof Error ? error.message : String(error)}`,\n { url: endpoint },\n );\n }\n })();\n\n return this.queryClientPromise;\n }\n\n /**\n * Get a signing client with all Manifest registries (for transactions)\n *\n * Automatically retries on transient connection failures with exponential backoff.\n */\n async getSigningClient(): Promise<SigningStargateClient> {\n if (!this.config.rpcUrl || !this.config.gasPrice) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.INVALID_CONFIG,\n 'Signing client requires rpcUrl and gasPrice configuration. Current config is query-only (REST).',\n );\n }\n\n // Return cached client if available\n if (this.signingClient) {\n return this.signingClient;\n }\n\n // If initialization is already in progress, wait for it\n if (this.signingClientPromise) {\n return this.signingClientPromise;\n }\n\n // Start initialization and cache the promise to prevent concurrent init\n this.signingClientPromise = (async () => {\n // Capture reference to detect if superseded by disconnect/config change\n const thisInitPromise = this.signingClientPromise;\n try {\n const signer = await this.walletProvider.getSigner();\n const gasPrice = GasPrice.fromString(this.config.gasPrice!);\n const { registry, aminoTypes } = getSigningManifestClientOptions();\n\n // Configure endpoint as HttpEndpoint object (required for custom options)\n const endpoint: HttpEndpoint = {\n url: this.config.rpcUrl!,\n headers: {},\n };\n\n // Note: Registry type from @cosmjs/proto-signing doesn't perfectly match\n // SigningStargateClientOptions due to telescope-generated proto types.\n // This is a known limitation with custom cosmos-sdk module registries.\n // Wrap with retry for transient connection failures\n const client = await withRetry(\n async () => {\n const c = await SigningStargateClient.connectWithSigner(\n endpoint,\n signer,\n {\n registry: registry as SigningClientRegistry,\n aminoTypes,\n gasPrice,\n broadcastTimeoutMs: DEFAULT_BROADCAST_TIMEOUT_MS,\n broadcastPollIntervalMs: DEFAULT_BROADCAST_POLL_INTERVAL_MS,\n },\n );\n // The property is private readonly with no constructor option,\n // so we must bypass TypeScript's access control to override it.\n const record = c as unknown as Record<string, unknown>;\n if (typeof record.defaultGasMultiplier === 'number') {\n record.defaultGasMultiplier =\n this.config.gasMultiplier ?? DEFAULT_GAS_MULTIPLIER;\n } else {\n const effective =\n this.config.gasMultiplier ?? DEFAULT_GAS_MULTIPLIER;\n logger.warn(\n `gasMultiplier ${effective} could not be applied: ` +\n `signing client defaultGasMultiplier is ${typeof record.defaultGasMultiplier}, expected number. ` +\n `Transactions will use the CosmJS built-in gas multiplier instead.`,\n );\n }\n return c;\n },\n {\n config: this.config.retry,\n operationName: 'connect signing client',\n },\n );\n // Only store if this is still the active promise\n if (this.signingClientPromise === thisInitPromise) {\n this.signingClient = client;\n this.signingClientPromise = null;\n } else {\n // Promise was superseded, clean up the client we just created\n client.disconnect();\n }\n return client;\n } catch (error) {\n // Clear promise on failure so retry is possible (only if still active)\n if (this.signingClientPromise === thisInitPromise) {\n this.signingClientPromise = null;\n }\n if (error instanceof ManifestMCPError) {\n throw error;\n }\n throw new ManifestMCPError(\n ManifestMCPErrorCode.RPC_CONNECTION_FAILED,\n `Failed to connect signing client: ${error instanceof Error ? error.message : String(error)}`,\n { rpcUrl: this.config.rpcUrl },\n );\n }\n })();\n\n return this.signingClientPromise;\n }\n\n /**\n * Get the wallet address\n */\n async getAddress(): Promise<string> {\n return this.walletProvider.getAddress();\n }\n\n /**\n * Get the configuration\n */\n getConfig(): ManifestMCPConfig {\n return this.config;\n }\n\n /**\n * Acquire a rate limit token before making an RPC request.\n * This will wait if the rate limit has been exceeded.\n */\n async acquireRateLimit(): Promise<void> {\n await this.rateLimiter.removeTokens(1);\n }\n\n /**\n * Disconnect the signing client and release query client references.\n * The query client's underlying HTTP transport is stateless and does not\n * require an explicit disconnect.\n */\n disconnect(): void {\n if (this.signingClient) {\n this.signingClient.disconnect();\n this.signingClient = null;\n }\n this.signingClientPromise = null;\n this.queryClient = null;\n this.queryClientPromise = null;\n }\n}\n"],"mappings":";;;;;;;;;;;AA6DA,MAAM,+BAA+B;;AAGrC,MAAM,qCAAqC;;;;AAK3C,SAAS,kCAAkC;AAiBzC,QAAO;EAAE,UAhBQ,IAAI,SAAS;GAC5B,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACJ,CAAC;EAUiB,YARA,IAAI,WAAW;GAChC,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACJ,CAAC;EAE6B;;;;;AAMjC,IAAa,sBAAb,MAAa,oBAAoB;CAa/B,YACE,QACA,gBACA;AAXF,OA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B;AAC5B,OAAK,cAAc;AACnB,OAAK,qBAAqB;;;AAjU5B,oBAAe,4BAA8C,IAAI,KAAK"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["cosmwasmNs","strangeloveVenturesNs","osmosisNs","ibcNs"],"sources":["../src/client.ts"],"sourcesContent":["import { Registry } from '@cosmjs/proto-signing';\nimport {\n AminoTypes,\n GasPrice,\n type HttpEndpoint,\n SigningStargateClient,\n} from '@cosmjs/stargate';\nimport {\n cosmosAminoConverters,\n cosmosProtoRegistry,\n cosmwasmAminoConverters,\n cosmwasm as cosmwasmNs,\n cosmwasmProtoRegistry,\n ibcAminoConverters,\n ibc as ibcNs,\n ibcProtoRegistry,\n liftedinit,\n liftedinitAminoConverters,\n liftedinitProtoRegistry,\n osmosisAminoConverters,\n osmosis as osmosisNs,\n osmosisProtoRegistry,\n strangeloveVenturesAminoConverters,\n strangelove_ventures as strangeloveVenturesNs,\n strangeloveVenturesProtoRegistry,\n} from '@manifest-network/manifestjs';\nimport { RateLimiter } from 'limiter';\nimport {\n DEFAULT_GAS_MULTIPLIER,\n DEFAULT_REQUESTS_PER_SECOND,\n} from './config.js';\nimport { createLCDQueryClient } from './lcd-adapter.js';\nimport { logger } from './logger.js';\nimport { withRetry } from './retry.js';\nimport {\n type ManifestMCPConfig,\n ManifestMCPError,\n ManifestMCPErrorCode,\n type WalletProvider,\n} from './types.js';\n\n// Combined query client type: liftedinit modules (cosmos + billing/manifest/sku) + cosmwasm\n// + strangelove_ventures (poa) + osmosis (tokenfactory) + ibc (transfer, channel, client, connection).\n// Uses Pick to extract only each factory's unique namespace, avoiding conflicts with overlapping cosmos types.\ntype LiftedinitQueryClient = Awaited<\n ReturnType<typeof liftedinit.ClientFactory.createRPCQueryClient>\n>;\ntype CosmwasmQueryClient = Awaited<\n ReturnType<typeof cosmwasmNs.ClientFactory.createRPCQueryClient>\n>;\ntype StrangeloveVenturesQueryClient = Awaited<\n ReturnType<typeof strangeloveVenturesNs.ClientFactory.createRPCQueryClient>\n>;\ntype OsmosisQueryClient = Awaited<\n ReturnType<typeof osmosisNs.ClientFactory.createRPCQueryClient>\n>;\ntype IbcQueryClient = Awaited<\n ReturnType<typeof ibcNs.ClientFactory.createRPCQueryClient>\n>;\nexport type ManifestQueryClient = LiftedinitQueryClient &\n Pick<CosmwasmQueryClient, 'cosmwasm'> &\n Pick<StrangeloveVenturesQueryClient, 'strangelove_ventures'> &\n Pick<OsmosisQueryClient, 'osmosis'> &\n Pick<IbcQueryClient, 'ibc'>;\n\n/**\n * Extract the registry type expected by SigningStargateClient.connectWithSigner.\n *\n * The Registry type from @cosmjs/proto-signing doesn't perfectly match the registry type\n * in SigningStargateClientOptions due to telescope-generated proto types. This type alias\n * extracts the expected registry type from the function signature to enable type-safe casting.\n */\ntype SigningClientRegistry = Parameters<\n typeof SigningStargateClient.connectWithSigner\n>[2] extends { registry?: infer R }\n ? R\n : never;\n\n/** Default timeout for transaction broadcast (60 seconds) */\nconst DEFAULT_BROADCAST_TIMEOUT_MS = 60_000;\n\n/** Default polling interval for transaction confirmation (3 seconds) */\nconst DEFAULT_BROADCAST_POLL_INTERVAL_MS = 3_000;\n\n/**\n * Get combined signing client options with all Manifest registries\n */\nfunction getSigningManifestClientOptions() {\n const registry = new Registry([\n ...cosmosProtoRegistry,\n ...liftedinitProtoRegistry,\n ...strangeloveVenturesProtoRegistry,\n ...osmosisProtoRegistry,\n ...cosmwasmProtoRegistry,\n ...ibcProtoRegistry,\n ]);\n\n const aminoTypes = new AminoTypes({\n ...cosmosAminoConverters,\n ...liftedinitAminoConverters,\n ...strangeloveVenturesAminoConverters,\n ...osmosisAminoConverters,\n ...cosmwasmAminoConverters,\n ...ibcAminoConverters,\n });\n\n return { registry, aminoTypes };\n}\n\n/**\n * Manages CosmJS client instances with lazy initialization and singleton pattern\n */\nexport class CosmosClientManager {\n private static instances: Map<string, CosmosClientManager> = new Map();\n\n private config: ManifestMCPConfig;\n private walletProvider: WalletProvider;\n private queryClient: ManifestQueryClient | null = null;\n private signingClient: SigningStargateClient | null = null;\n private rateLimiter: RateLimiter;\n\n // Promises to prevent concurrent client initialization (lazy init race condition)\n private queryClientPromise: Promise<ManifestQueryClient> | null = null;\n private signingClientPromise: Promise<SigningStargateClient> | null = null;\n\n private constructor(\n config: ManifestMCPConfig,\n walletProvider: WalletProvider,\n ) {\n this.config = config;\n this.walletProvider = walletProvider;\n\n // Initialize rate limiter with configured or default requests per second\n const requestsPerSecond =\n config.rateLimit?.requestsPerSecond ?? DEFAULT_REQUESTS_PER_SECOND;\n this.rateLimiter = new RateLimiter({\n tokensPerInterval: requestsPerSecond,\n interval: 'second',\n });\n }\n\n /**\n * Get or create a singleton instance for the given config.\n * Instances are keyed by chainId:rpcUrl:restUrl. For existing instances:\n * - Config and walletProvider references are always updated\n * - Signing client is disconnected/recreated if gasPrice, gasMultiplier, or walletProvider changed\n * - Rate limiter is updated if requestsPerSecond changed (without affecting signing client)\n */\n static getInstance(\n config: ManifestMCPConfig,\n walletProvider: WalletProvider,\n ): CosmosClientManager {\n const parts = [config.chainId, config.rpcUrl ?? ''];\n if (config.restUrl) parts.push(config.restUrl);\n const key = parts.join(':');\n let instance = CosmosClientManager.instances.get(key);\n\n if (!instance) {\n instance = new CosmosClientManager(config, walletProvider);\n CosmosClientManager.instances.set(key, instance);\n } else {\n // Check what changed to determine what needs updating\n const signingClientAffected =\n instance.config.gasPrice !== config.gasPrice ||\n instance.config.gasMultiplier !== config.gasMultiplier ||\n instance.walletProvider !== walletProvider;\n\n const rateLimitChanged =\n instance.config.rateLimit?.requestsPerSecond !==\n config.rateLimit?.requestsPerSecond;\n\n // Always update config reference\n instance.config = config;\n instance.walletProvider = walletProvider;\n\n // Only invalidate signing client if fields it depends on changed\n if (signingClientAffected) {\n if (instance.signingClient) {\n instance.signingClient.disconnect();\n instance.signingClient = null;\n }\n // Also clear the promise to allow re-initialization with new config\n instance.signingClientPromise = null;\n }\n\n // Update rate limiter independently (doesn't affect signing client)\n if (rateLimitChanged) {\n const newRps =\n config.rateLimit?.requestsPerSecond ?? DEFAULT_REQUESTS_PER_SECOND;\n instance.rateLimiter = new RateLimiter({\n tokensPerInterval: newRps,\n interval: 'second',\n });\n }\n }\n\n return instance;\n }\n\n /**\n * Clear all cached instances (useful for testing or reconnection).\n * Disconnects signing clients and releases query client references before clearing.\n */\n static clearInstances(): void {\n for (const instance of CosmosClientManager.instances.values()) {\n instance.disconnect();\n }\n CosmosClientManager.instances.clear();\n }\n\n /**\n * Get the manifestjs RPC query client with all module extensions\n *\n * Automatically retries on transient connection failures with exponential backoff.\n */\n async getQueryClient(): Promise<ManifestQueryClient> {\n // Return cached client if available\n if (this.queryClient) {\n return this.queryClient;\n }\n\n // If initialization is already in progress, wait for it\n if (this.queryClientPromise) {\n return this.queryClientPromise;\n }\n\n // Start initialization and cache the promise to prevent concurrent init\n this.queryClientPromise = (async () => {\n // Capture reference to detect if superseded by disconnect/config change\n const thisInitPromise = this.queryClientPromise;\n try {\n let client: ManifestQueryClient;\n if (this.config.restUrl) {\n // Use LCD/REST for queries when restUrl is configured\n client = await withRetry(\n () => createLCDQueryClient(this.config.restUrl!),\n {\n config: this.config.retry,\n operationName: 'connect LCD query client',\n },\n );\n } else if (this.config.rpcUrl) {\n // Use RPC: merge liftedinit + cosmwasm + strangelove_ventures + osmosis + ibc namespaces\n client = await withRetry(\n async () => {\n const [\n liftedinitClient,\n cosmwasmClient,\n strangeloveClient,\n osmosisClient,\n ibcClient,\n ] = await Promise.all([\n liftedinit.ClientFactory.createRPCQueryClient({\n rpcEndpoint: this.config.rpcUrl!,\n }),\n cosmwasmNs.ClientFactory.createRPCQueryClient({\n rpcEndpoint: this.config.rpcUrl!,\n }),\n strangeloveVenturesNs.ClientFactory.createRPCQueryClient({\n rpcEndpoint: this.config.rpcUrl!,\n }),\n osmosisNs.ClientFactory.createRPCQueryClient({\n rpcEndpoint: this.config.rpcUrl!,\n }),\n ibcNs.ClientFactory.createRPCQueryClient({\n rpcEndpoint: this.config.rpcUrl!,\n }),\n ]);\n return {\n ...liftedinitClient,\n cosmwasm: cosmwasmClient.cosmwasm,\n strangelove_ventures: strangeloveClient.strangelove_ventures,\n osmosis: osmosisClient.osmosis,\n ibc: ibcClient.ibc,\n } as ManifestQueryClient;\n },\n {\n config: this.config.retry,\n operationName: 'connect query client',\n },\n );\n } else {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.INVALID_CONFIG,\n 'Cannot create query client: neither restUrl nor rpcUrl is configured.',\n );\n }\n // Only store if this is still the active promise\n if (this.queryClientPromise === thisInitPromise) {\n this.queryClient = client;\n this.queryClientPromise = null;\n }\n return client;\n } catch (error) {\n // Clear promise on failure so retry is possible (only if still active)\n if (this.queryClientPromise === thisInitPromise) {\n this.queryClientPromise = null;\n }\n if (error instanceof ManifestMCPError) {\n throw error;\n }\n const endpoint = this.config.restUrl ?? this.config.rpcUrl;\n throw new ManifestMCPError(\n ManifestMCPErrorCode.RPC_CONNECTION_FAILED,\n `Failed to connect to ${this.config.restUrl ? 'REST' : 'RPC'} endpoint: ${error instanceof Error ? error.message : String(error)}`,\n { url: endpoint },\n );\n }\n })();\n\n return this.queryClientPromise;\n }\n\n /**\n * Get a signing client with all Manifest registries (for transactions)\n *\n * Automatically retries on transient connection failures with exponential backoff.\n */\n async getSigningClient(): Promise<SigningStargateClient> {\n if (!this.config.rpcUrl || !this.config.gasPrice) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.INVALID_CONFIG,\n 'Signing client requires rpcUrl and gasPrice configuration. Current config is query-only (REST).',\n );\n }\n\n // Return cached client if available\n if (this.signingClient) {\n return this.signingClient;\n }\n\n // If initialization is already in progress, wait for it\n if (this.signingClientPromise) {\n return this.signingClientPromise;\n }\n\n // Start initialization and cache the promise to prevent concurrent init\n this.signingClientPromise = (async () => {\n // Capture reference to detect if superseded by disconnect/config change\n const thisInitPromise = this.signingClientPromise;\n try {\n const signer = await this.walletProvider.getSigner();\n const gasPrice = GasPrice.fromString(this.config.gasPrice!);\n const { registry, aminoTypes } = getSigningManifestClientOptions();\n\n // Configure endpoint as HttpEndpoint object (required for custom options)\n const endpoint: HttpEndpoint = {\n url: this.config.rpcUrl!,\n headers: {},\n };\n\n // Note: Registry type from @cosmjs/proto-signing doesn't perfectly match\n // SigningStargateClientOptions due to telescope-generated proto types.\n // This is a known limitation with custom cosmos-sdk module registries.\n // Wrap with retry for transient connection failures\n const client = await withRetry(\n async () => {\n const c = await SigningStargateClient.connectWithSigner(\n endpoint,\n signer,\n {\n registry: registry as SigningClientRegistry,\n aminoTypes,\n gasPrice,\n broadcastTimeoutMs: DEFAULT_BROADCAST_TIMEOUT_MS,\n broadcastPollIntervalMs: DEFAULT_BROADCAST_POLL_INTERVAL_MS,\n },\n );\n // The property is private readonly with no constructor option,\n // so we must bypass TypeScript's access control to override it.\n const record = c as unknown as Record<string, unknown>;\n if (typeof record.defaultGasMultiplier === 'number') {\n record.defaultGasMultiplier =\n this.config.gasMultiplier ?? DEFAULT_GAS_MULTIPLIER;\n } else {\n const effective =\n this.config.gasMultiplier ?? DEFAULT_GAS_MULTIPLIER;\n logger.warn(\n `gasMultiplier ${effective} could not be applied: ` +\n `signing client defaultGasMultiplier is ${typeof record.defaultGasMultiplier}, expected number. ` +\n `Transactions will use the CosmJS built-in gas multiplier instead.`,\n );\n }\n return c;\n },\n {\n config: this.config.retry,\n operationName: 'connect signing client',\n },\n );\n // Only store if this is still the active promise\n if (this.signingClientPromise === thisInitPromise) {\n this.signingClient = client;\n this.signingClientPromise = null;\n } else {\n // Promise was superseded, clean up the client we just created\n client.disconnect();\n }\n return client;\n } catch (error) {\n // Clear promise on failure so retry is possible (only if still active)\n if (this.signingClientPromise === thisInitPromise) {\n this.signingClientPromise = null;\n }\n if (error instanceof ManifestMCPError) {\n throw error;\n }\n throw new ManifestMCPError(\n ManifestMCPErrorCode.RPC_CONNECTION_FAILED,\n `Failed to connect signing client: ${error instanceof Error ? error.message : String(error)}`,\n { rpcUrl: this.config.rpcUrl },\n );\n }\n })();\n\n return this.signingClientPromise;\n }\n\n /**\n * Get the wallet address\n */\n async getAddress(): Promise<string> {\n return this.walletProvider.getAddress();\n }\n\n /**\n * Get the configuration\n */\n getConfig(): ManifestMCPConfig {\n return this.config;\n }\n\n /**\n * Acquire a rate limit token before making an RPC request.\n * This will wait if the rate limit has been exceeded.\n */\n async acquireRateLimit(): Promise<void> {\n await this.rateLimiter.removeTokens(1);\n }\n\n /**\n * Disconnect the signing client and release query client references.\n * The query client's underlying HTTP transport is stateless and does not\n * require an explicit disconnect.\n */\n disconnect(): void {\n if (this.signingClient) {\n this.signingClient.disconnect();\n this.signingClient = null;\n }\n this.signingClientPromise = null;\n this.queryClient = null;\n this.queryClientPromise = null;\n }\n}\n"],"mappings":";;;;;;;;;;;AA+EA,MAAM,+BAA+B;;AAGrC,MAAM,qCAAqC;;;;AAK3C,SAAS,kCAAkC;AAmBzC,QAAO;EAAE,UAlBQ,IAAI,SAAS;GAC5B,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACJ,CAAC;EAWiB,YATA,IAAI,WAAW;GAChC,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACJ,CAAC;EAE6B;;;;;AAMjC,IAAa,sBAAb,MAAa,oBAAoB;CAa/B,YACE,QACA,gBACA;AAXF,OAAQ,cAA0C;AAClD,OAAQ,gBAA8C;AAItD,OAAQ,qBAA0D;AAClE,OAAQ,uBAA8D;AAMpE,OAAK,SAAS;AACd,OAAK,iBAAiB;AAKtB,OAAK,cAAc,IAAI,YAAY;GACjC,mBAFA,OAAO,WAAW,qBAAA;GAGlB,UAAU;GACX,CAAC;;;;;;;;;CAUJ,OAAO,YACL,QACA,gBACqB;EACrB,MAAM,QAAQ,CAAC,OAAO,SAAS,OAAO,UAAU,GAAG;AACnD,MAAI,OAAO,QAAS,OAAM,KAAK,OAAO,QAAQ;EAC9C,MAAM,MAAM,MAAM,KAAK,IAAI;EAC3B,IAA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|
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";
|
|
1
|
+
import { AccountInfo, AccountInfoResult, AddressBytesToStringResult, AddressStringToBytesResult, Any, AuthAccountResult, AuthAccountsResult, AuthParams, AuthParamsResult, AuthzGrant, AuthzGrantAuthorization, AuthzGranteeGrantsResult, AuthzGranterGrantsResult, AuthzGrantsResult, 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, DenomAuthorityMetadata, DenomAuthorityMetadataResult, DenomMetadataResult, DenomTrace, DenomsFromAdminResult, DenomsFromCreatorResult, DenomsMetadataResult, DepositParams, DepositResult, DepositsResult, DistributionParams, DistributionParamsResult, FeeEstimateResult, FeegrantAllowanceResult, FeegrantAllowancesResult, FeegrantGrant, GovDeposit, GovParams, GovParamsResult, GovProposal, GovTallyResult, GovVote, GroupInfo, GroupInfoResult, GroupMember, GroupMembersResult, GroupPoliciesResult, GroupPolicyInfo, GroupPolicyInfoResult, GroupProposal, GroupProposalResult, GroupProposalsResult, GroupTallyQueryResult, GroupTallyResult, GroupVote, GroupVoteResult, GroupVotesResult, GroupsResult, HistoricalInfo, HistoricalInfoResult, IbcDenomTraceResult, IbcDenomTracesResult, IbcTransferParams, IbcTransferParamsResult, Lease, LeaseItemInput, LeaseResult, LeasesResult, ManifestMCPConfig, ManifestMCPError, ManifestMCPErrorCode, MintAnnualProvisionsResult, MintInflationResult, MintParams, MintParamsResult, Model, ModuleAccount, ModuleAccountsResult, ModuleInfo, PaginatedResult, PaginationResponse, PoAAuthorityResult, PoAConsensusPowerResult, PoAPendingValidatorsResult, PoAStakingParams, PoAValidator, 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, TokenfactoryParams, TokenfactoryParamsResult, 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
5
|
import { cosmosEstimateFee, cosmosQuery, cosmosTx } from "./cosmos.js";
|
|
6
6
|
import { createLCDQueryClient } from "./lcd-adapter.js";
|
|
7
|
-
import { LogLevel, logger } from "./logger.js";
|
|
7
|
+
import { LogLevel, logger, parseLogLevel } from "./logger.js";
|
|
8
8
|
import { getAvailableModules, getModuleSubcommands, getSubcommandUsage, getSupportedModules, isSubcommandSupported } from "./modules.js";
|
|
9
9
|
import { validateAddress } from "./transactions/utils.js";
|
|
10
10
|
import { MAX_PAGE_LIMIT, createPagination } from "./queries/utils.js";
|
|
11
|
-
import { INFRASTRUCTURE_ERROR_CODES, ManifestMCPServerOptions, MnemonicServerConfig, SENSITIVE_FIELDS, bigIntReplacer, createMnemonicServer, jsonResponse, sanitizeForLogging, withErrorHandling } from "./server-utils.js";
|
|
11
|
+
import { INFRASTRUCTURE_ERROR_CODES, ManifestMCPServerOptions, MnemonicServerConfig, SENSITIVE_FIELDS, bigIntReplacer, createMnemonicServer, jsonResponse, sanitizeForLogging, structuredResponse, withErrorHandling } from "./server-utils.js";
|
|
12
|
+
import { MANIFEST_TOOL_META_VERSION, ManifestToolMeta, ManifestToolMetaContainer, ManifestToolMetaVersion, manifestMeta, mutatingAnnotations, readOnlyAnnotations } from "./tool-metadata.js";
|
|
12
13
|
import { FundCreditsResult, fundCredits } from "./tools/fundCredits.js";
|
|
13
14
|
import { getBalance } from "./tools/getBalance.js";
|
|
14
15
|
import { StopAppResult, stopApp } from "./tools/stopApp.js";
|
|
@@ -17,4 +18,4 @@ import { VERSION } from "./version.js";
|
|
|
17
18
|
import { MnemonicWalletProvider } from "./wallet/mnemonic.js";
|
|
18
19
|
import { signArbitraryWithAmino } from "./wallet/sign-arbitrary.js";
|
|
19
20
|
import { LeaseState, leaseStateFromJSON, leaseStateToJSON } from "@manifest-network/manifestjs/dist/codegen/liftedinit/billing/v1/types.js";
|
|
20
|
-
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, type FundCreditsResult, 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, validateAddress, validateConfig, withErrorHandling, withRetry };
|
|
21
|
+
export { AccountInfo, AccountInfoResult, AddressBytesToStringResult, AddressStringToBytesResult, Any, AuthAccountResult, AuthAccountsResult, AuthParams, AuthParamsResult, AuthzGrant, AuthzGrantAuthorization, AuthzGranteeGrantsResult, AuthzGranterGrantsResult, AuthzGrantsResult, 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, DenomAuthorityMetadata, DenomAuthorityMetadataResult, DenomMetadataResult, DenomTrace, DenomsFromAdminResult, DenomsFromCreatorResult, DenomsMetadataResult, DepositParams, DepositResult, DepositsResult, DistributionParams, DistributionParamsResult, FeeEstimateResult, FeegrantAllowanceResult, FeegrantAllowancesResult, FeegrantGrant, type FundCreditsResult, 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, IbcDenomTraceResult, IbcDenomTracesResult, IbcTransferParams, IbcTransferParamsResult, Lease, LeaseItemInput, LeaseResult, LeaseState, LeasesResult, type LogLevel, MANIFEST_TOOL_META_VERSION, MAX_PAGE_LIMIT, ManifestMCPConfig, ManifestMCPError, ManifestMCPErrorCode, type ManifestMCPServerOptions, type ManifestQueryClient, type ManifestToolMeta, type ManifestToolMetaContainer, type ManifestToolMetaVersion, MintAnnualProvisionsResult, MintInflationResult, MintParams, MintParamsResult, type MnemonicServerConfig, MnemonicWalletProvider, Model, ModuleAccount, ModuleAccountsResult, ModuleInfo, PaginatedResult, PaginationResponse, PoAAuthorityResult, PoAConsensusPowerResult, PoAPendingValidatorsResult, PoAStakingParams, PoAValidator, 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, TokenfactoryParams, TokenfactoryParamsResult, 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, manifestMeta, mutatingAnnotations, optionalBoolean, parseArgs, parseLogLevel, readOnlyAnnotations, requireString, requireStringEnum, requireUuid, sanitizeForLogging, signArbitraryWithAmino, stopApp, structuredResponse, validateAddress, validateConfig, withErrorHandling, withRetry };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ManifestMCPError, ManifestMCPErrorCode } from "./types.js";
|
|
2
2
|
import { DEFAULT_RETRY_CONFIG, calculateBackoff, isRetryableError, withRetry } from "./retry.js";
|
|
3
3
|
import { createConfig, createValidatedConfig, validateConfig } from "./config.js";
|
|
4
|
-
import { logger } from "./logger.js";
|
|
4
|
+
import { logger, parseLogLevel } from "./logger.js";
|
|
5
5
|
import { createLCDQueryClient } from "./lcd-adapter.js";
|
|
6
6
|
import { CosmosClientManager } from "./client.js";
|
|
7
7
|
import { DNS_LABEL_RE, optionalBoolean, parseArgs, requireString, requireStringEnum, requireUuid } from "./validation.js";
|
|
@@ -12,10 +12,11 @@ import { cosmosEstimateFee, cosmosQuery, cosmosTx } from "./cosmos.js";
|
|
|
12
12
|
import { signArbitraryWithAmino } from "./wallet/sign-arbitrary.js";
|
|
13
13
|
import { MnemonicWalletProvider } from "./wallet/mnemonic.js";
|
|
14
14
|
import "./wallet/index.js";
|
|
15
|
-
import { INFRASTRUCTURE_ERROR_CODES, SENSITIVE_FIELDS, bigIntReplacer, createMnemonicServer, jsonResponse, sanitizeForLogging, withErrorHandling } from "./server-utils.js";
|
|
15
|
+
import { INFRASTRUCTURE_ERROR_CODES, SENSITIVE_FIELDS, bigIntReplacer, createMnemonicServer, jsonResponse, sanitizeForLogging, structuredResponse, withErrorHandling } from "./server-utils.js";
|
|
16
|
+
import { MANIFEST_TOOL_META_VERSION, manifestMeta, mutatingAnnotations, readOnlyAnnotations } from "./tool-metadata.js";
|
|
16
17
|
import { fundCredits } from "./tools/fundCredits.js";
|
|
17
18
|
import { getBalance } from "./tools/getBalance.js";
|
|
18
19
|
import { stopApp } from "./tools/stopApp.js";
|
|
19
20
|
import { VERSION } from "./version.js";
|
|
20
21
|
import { LeaseState, leaseStateFromJSON, leaseStateToJSON } from "@manifest-network/manifestjs/dist/codegen/liftedinit/billing/v1/types.js";
|
|
21
|
-
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, validateAddress, validateConfig, withErrorHandling, withRetry };
|
|
22
|
+
export { CosmosClientManager, DEFAULT_RETRY_CONFIG, DNS_LABEL_RE, INFRASTRUCTURE_ERROR_CODES, LeaseState, MANIFEST_TOOL_META_VERSION, 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, manifestMeta, mutatingAnnotations, optionalBoolean, parseArgs, parseLogLevel, readOnlyAnnotations, requireString, requireStringEnum, requireUuid, sanitizeForLogging, signArbitraryWithAmino, stopApp, structuredResponse, validateAddress, validateConfig, withErrorHandling, withRetry };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lcd-adapter.d.ts","names":[],"sources":["../src/lcd-adapter.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"lcd-adapter.d.ts","names":[],"sources":["../src/lcd-adapter.ts"],"mappings":";;;iBAiBS,gBAAA,CAAiB,GAAA;AAAA,UAwBhB,SAAA;EACR,QAAA,CAAS,MAAA;AAAA;AAAA,iBAGF,aAAA,CACP,SAAA,EAAW,MAAA,mBACX,UAAA,WACC,SAAA;AAAA,KAiBE,OAAA,OAAc,IAAA,gBAAoB,OAAA;AAAA,iBAE9B,WAAA,CACP,MAAA,WACA,WAAA,YACC,MAAA,SAAe,OAAA;AAAA,iBAqCT,iBAAA,CAAkB,UAAA;;;;;AAjED;;iBAwFjB,kBAAA,CAAmB,OAAA,YAAmB,MAAA;AAAA,iBAqCzB,oBAAA,CACpB,YAAA,WACC,OAAA,CAAQ,mBAAA"}
|
package/dist/lcd-adapter.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ManifestMCPError, ManifestMCPErrorCode } from "./types.js";
|
|
2
2
|
import { logger } from "./logger.js";
|
|
3
|
-
import { cosmos, cosmwasm, liftedinit } from "@manifest-network/manifestjs";
|
|
3
|
+
import { cosmos, cosmwasm, ibc, liftedinit, osmosis, strangelove_ventures } from "@manifest-network/manifestjs";
|
|
4
4
|
import { toBase64, toUtf8 } from "@cosmjs/encoding";
|
|
5
5
|
//#region src/lcd-adapter.ts
|
|
6
6
|
function snakeToCamel(s) {
|
|
@@ -86,8 +86,17 @@ function patchWasmQueryData(wasmLcd) {
|
|
|
86
86
|
async function createLCDQueryClient(restEndpoint) {
|
|
87
87
|
let lcd;
|
|
88
88
|
let cosmwasmLcd;
|
|
89
|
+
let strangeloveLcd;
|
|
90
|
+
let osmosisLcd;
|
|
91
|
+
let ibcLcd;
|
|
89
92
|
try {
|
|
90
|
-
[lcd, cosmwasmLcd] = await Promise.all([
|
|
93
|
+
[lcd, cosmwasmLcd, strangeloveLcd, osmosisLcd, ibcLcd] = await Promise.all([
|
|
94
|
+
liftedinit.ClientFactory.createLCDClient({ restEndpoint }),
|
|
95
|
+
cosmwasm.ClientFactory.createLCDClient({ restEndpoint }),
|
|
96
|
+
strangelove_ventures.ClientFactory.createLCDClient({ restEndpoint }),
|
|
97
|
+
osmosis.ClientFactory.createLCDClient({ restEndpoint }),
|
|
98
|
+
ibc.ClientFactory.createLCDClient({ restEndpoint })
|
|
99
|
+
]);
|
|
91
100
|
} catch (error) {
|
|
92
101
|
throw new ManifestMCPError(ManifestMCPErrorCode.RPC_CONNECTION_FAILED, `Failed to create LCD client for ${restEndpoint}: ${error instanceof Error ? error.message : String(error)}`);
|
|
93
102
|
}
|
|
@@ -119,7 +128,17 @@ async function createLCDQueryClient(restEndpoint) {
|
|
|
119
128
|
manifest: { v1: unsupportedModule("liftedinit.manifest.v1") },
|
|
120
129
|
sku: { v1: adaptModule(lcd.liftedinit.sku.v1, liftedinit.sku.v1) }
|
|
121
130
|
},
|
|
122
|
-
cosmwasm: { wasm: { v1: adaptModule(patchWasmQueryData(cosmwasmLcd.cosmwasm.wasm.v1), cosmwasm.wasm.v1) } }
|
|
131
|
+
cosmwasm: { wasm: { v1: adaptModule(patchWasmQueryData(cosmwasmLcd.cosmwasm.wasm.v1), cosmwasm.wasm.v1) } },
|
|
132
|
+
strangelove_ventures: { poa: { v1: adaptModule(strangeloveLcd.strangelove_ventures.poa.v1, strangelove_ventures.poa.v1) } },
|
|
133
|
+
osmosis: { tokenfactory: { v1beta1: adaptModule(osmosisLcd.osmosis.tokenfactory.v1beta1, osmosis.tokenfactory.v1beta1) } },
|
|
134
|
+
ibc: {
|
|
135
|
+
applications: { transfer: { v1: adaptModule(ibcLcd.ibc.applications.transfer.v1, ibc.applications.transfer.v1) } },
|
|
136
|
+
core: {
|
|
137
|
+
channel: { v1: adaptModule(ibcLcd.ibc.core.channel.v1, ibc.core.channel.v1) },
|
|
138
|
+
client: { v1: adaptModule(ibcLcd.ibc.core.client.v1, ibc.core.client.v1) },
|
|
139
|
+
connection: { v1: adaptModule(ibcLcd.ibc.core.connection.v1, ibc.core.connection.v1) }
|
|
140
|
+
}
|
|
141
|
+
}
|
|
123
142
|
};
|
|
124
143
|
} catch (error) {
|
|
125
144
|
if (error instanceof ManifestMCPError) throw error;
|
package/dist/lcd-adapter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lcd-adapter.js","names":["cosmwasmNs"],"sources":["../src/lcd-adapter.ts"],"sourcesContent":["import { toBase64, toUtf8 } from '@cosmjs/encoding';\nimport {\n cosmos,\n cosmwasm as cosmwasmNs,\n liftedinit,\n} from '@manifest-network/manifestjs';\nimport type { ManifestQueryClient } from './client.js';\nimport { logger } from './logger.js';\nimport { ManifestMCPError, ManifestMCPErrorCode } from './types.js';\n\nfunction snakeToCamel(s: string): string {\n return s.replace(/_(.)/g, (_, c: string) => c.toUpperCase());\n}\n\nfunction snakeToCamelDeep(obj: unknown): unknown {\n if (Array.isArray(obj)) {\n return obj.map(snakeToCamelDeep);\n }\n if (\n obj !== null &&\n typeof obj === 'object' &&\n !(obj instanceof Date) &&\n !(obj instanceof Uint8Array)\n ) {\n return Object.fromEntries(\n Object.entries(obj as Record<string, unknown>).map(([k, v]) => [\n snakeToCamel(k),\n snakeToCamelDeep(v),\n ]),\n );\n }\n return obj;\n}\n\nfunction ucFirst(s: string): string {\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n\ninterface Converter {\n fromJSON(object: unknown): unknown;\n}\n\nfunction findConverter(\n namespace: Record<string, unknown>,\n methodName: string,\n): Converter {\n const uc = ucFirst(methodName);\n const queryName = `Query${uc}Response`;\n const plainName = `${uc}Response`;\n\n const converter = (namespace[queryName] ?? namespace[plainName]) as\n | Converter\n | undefined;\n if (!converter?.fromJSON) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.QUERY_FAILED,\n `No response converter found for method \"${methodName}\" (tried \"${queryName}\" and \"${plainName}\")`,\n );\n }\n return converter;\n}\n\ntype AsyncFn = (...args: unknown[]) => Promise<unknown>;\n\nfunction adaptModule(\n lcdMod: unknown,\n converterNs: unknown,\n): Record<string, AsyncFn> {\n const lcdModule = lcdMod as Record<string, unknown>;\n const converterNamespace = converterNs as Record<string, unknown>;\n const adapted: Record<string, AsyncFn> = {};\n\n for (const key of Object.keys(lcdModule)) {\n if (key === 'req' || typeof lcdModule[key] !== 'function') continue;\n\n const originalFn = lcdModule[key] as AsyncFn;\n const converter = findConverter(converterNamespace, key);\n\n adapted[key] = async (...args: unknown[]) => {\n let sdkResult: unknown;\n try {\n sdkResult = await originalFn.call(lcdModule, ...args);\n } catch (error) {\n if (error instanceof ManifestMCPError) throw error;\n throw new ManifestMCPError(\n ManifestMCPErrorCode.QUERY_FAILED,\n `LCD query \"${key}\" failed: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n const camelCased = snakeToCamelDeep(sdkResult);\n try {\n return converter.fromJSON(camelCased);\n } catch (error) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.QUERY_FAILED,\n `Failed to convert LCD response for \"${key}\": ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n };\n }\n\n return adapted;\n}\n\nfunction unsupportedModule(modulePath: string): unknown {\n return new Proxy(\n {},\n {\n get(_target, prop) {\n if (typeof prop === 'string') {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.UNSUPPORTED_QUERY,\n `Module \"${modulePath}\" is not available via LCD/REST. Use an RPC endpoint instead.`,\n );\n }\n return undefined;\n },\n },\n );\n}\n\n/**\n * The generated LCD client interpolates `queryData` (Uint8Array) directly into\n * the URL path via template literal, producing comma-separated byte values\n * (e.g. `smart/123,34,99,...`) instead of base64. The REST API expects base64.\n * Patch the methods to convert queryData before the URL is constructed.\n */\nfunction patchWasmQueryData(wasmLcd: unknown): Record<string, unknown> {\n const mod = wasmLcd as Record<string, unknown>;\n const patched: Record<string, unknown> = { ...mod };\n for (const method of ['smartContractState', 'rawContractState']) {\n const original = mod[method] as (\n params: Record<string, unknown>,\n ) => Promise<unknown>;\n if (typeof original !== 'function') {\n logger.warn(\n `patchWasmQueryData: expected method \"${method}\" not found on wasm LCD module. Wasm queries may fail with malformed URLs.`,\n );\n continue;\n }\n patched[method] = async (params: Record<string, unknown>) => {\n const queryData = params.queryData;\n const result = (await original.call(mod, {\n ...params,\n queryData:\n queryData instanceof Uint8Array ? toBase64(queryData) : queryData,\n })) as Record<string, unknown>;\n\n // The LCD REST API returns `data` as a parsed JSON object, but the\n // protobuf `fromJSON` converter expects a base64 string representing\n // the UTF-8 bytes of the JSON payload. Re-encode so the adapter's\n // normal snakeToCamel → fromJSON pipeline works correctly.\n if (result.data != null && typeof result.data !== 'string') {\n return {\n ...result,\n data: toBase64(toUtf8(JSON.stringify(result.data))),\n };\n }\n return result;\n };\n }\n return patched;\n}\n\nexport async function createLCDQueryClient(\n restEndpoint: string,\n): Promise<ManifestQueryClient> {\n let lcd: Awaited<ReturnType<typeof liftedinit.ClientFactory.createLCDClient>>;\n let cosmwasmLcd: Awaited<\n ReturnType<typeof cosmwasmNs.ClientFactory.createLCDClient>\n >;\n try {\n [lcd, cosmwasmLcd] = await Promise.all([\n liftedinit.ClientFactory.createLCDClient({ restEndpoint }),\n cosmwasmNs.ClientFactory.createLCDClient({ restEndpoint }),\n ]);\n } catch (error) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.RPC_CONNECTION_FAILED,\n `Failed to create LCD client for ${restEndpoint}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n try {\n return {\n cosmos: {\n auth: {\n v1beta1: adaptModule(lcd.cosmos.auth.v1beta1, cosmos.auth.v1beta1),\n },\n authz: {\n v1beta1: adaptModule(lcd.cosmos.authz.v1beta1, cosmos.authz.v1beta1),\n },\n bank: {\n v1beta1: adaptModule(lcd.cosmos.bank.v1beta1, cosmos.bank.v1beta1),\n },\n base: {\n node: {\n v1beta1: adaptModule(\n lcd.cosmos.base.node.v1beta1,\n cosmos.base.node.v1beta1,\n ),\n },\n },\n circuit: { v1: adaptModule(lcd.cosmos.circuit.v1, cosmos.circuit.v1) },\n consensus: {\n v1: adaptModule(lcd.cosmos.consensus.v1, cosmos.consensus.v1),\n },\n distribution: {\n v1beta1: adaptModule(\n lcd.cosmos.distribution.v1beta1,\n cosmos.distribution.v1beta1,\n ),\n },\n feegrant: {\n v1beta1: adaptModule(\n lcd.cosmos.feegrant.v1beta1,\n cosmos.feegrant.v1beta1,\n ),\n },\n gov: {\n v1: adaptModule(lcd.cosmos.gov.v1, cosmos.gov.v1),\n v1beta1: adaptModule(lcd.cosmos.gov.v1beta1, cosmos.gov.v1beta1),\n },\n group: { v1: adaptModule(lcd.cosmos.group.v1, cosmos.group.v1) },\n mint: {\n v1beta1: adaptModule(lcd.cosmos.mint.v1beta1, cosmos.mint.v1beta1),\n },\n orm: {\n query: { v1alpha1: unsupportedModule('cosmos.orm.query.v1alpha1') },\n },\n params: {\n v1beta1: adaptModule(\n lcd.cosmos.params.v1beta1,\n cosmos.params.v1beta1,\n ),\n },\n staking: {\n v1beta1: adaptModule(\n lcd.cosmos.staking.v1beta1,\n cosmos.staking.v1beta1,\n ),\n },\n tx: { v1beta1: adaptModule(lcd.cosmos.tx.v1beta1, cosmos.tx.v1beta1) },\n upgrade: {\n v1beta1: adaptModule(\n lcd.cosmos.upgrade.v1beta1,\n cosmos.upgrade.v1beta1,\n ),\n },\n },\n liftedinit: {\n billing: {\n v1: adaptModule(lcd.liftedinit.billing.v1, liftedinit.billing.v1),\n },\n manifest: { v1: unsupportedModule('liftedinit.manifest.v1') },\n sku: { v1: adaptModule(lcd.liftedinit.sku.v1, liftedinit.sku.v1) },\n },\n cosmwasm: {\n wasm: {\n v1: adaptModule(\n patchWasmQueryData(cosmwasmLcd.cosmwasm.wasm.v1),\n cosmwasmNs.wasm.v1,\n ),\n },\n },\n } as ManifestQueryClient;\n } catch (error) {\n if (error instanceof ManifestMCPError) throw error;\n throw new ManifestMCPError(\n ManifestMCPErrorCode.RPC_CONNECTION_FAILED,\n `Failed to adapt LCD modules: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n}\n\n// Re-export for testing\nexport {\n adaptModule as _adaptModule,\n findConverter as _findConverter,\n patchWasmQueryData as _patchWasmQueryData,\n snakeToCamelDeep as _snakeToCamelDeep,\n unsupportedModule as _unsupportedModule,\n};\n"],"mappings":";;;;;AAUA,SAAS,aAAa,GAAmB;AACvC,QAAO,EAAE,QAAQ,UAAU,GAAG,MAAc,EAAE,aAAa,CAAC;;AAG9D,SAAS,iBAAiB,KAAuB;AAC/C,KAAI,MAAM,QAAQ,IAAI,CACpB,QAAO,IAAI,IAAI,iBA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AAI,OAAO,QAAQ,SACnB,OAAO,QAAQ,QAChB,EACF;IACF;GACD,YAAY;IACV,SAAS,EACP,IAAI,YAAY,IAAI,WAAW,QAAQ,IAAI,WAAW,QAAQ,GAAG,EAClE;IACD,UAAU,EAAE,IAAI,kBAAkB,yBAAyB,EAAE;IAC7D,KAAK,EAAE,IAAI,YAAY,IAAI,WAAW,IAAI,IAAI,WAAW,IAAI,GAAG,EAAE;IACnE;GACD,UAAU,EACR,MAAM,EACJ,IAAI,YACF,mBAAmB,YAAY,SAAS,KAAK,GAAG,EAChDA,SAAW,KAAK,GACjB,EACF,EACF;GACF;UACM,OAAO;AACd,MAAI,iBAAiB,iBAAkB,OAAM;AAC7C,QAAM,IAAI,iBACR,qBAAqB,uBACrB,gCAAgC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GACvF"}
|
|
1
|
+
{"version":3,"file":"lcd-adapter.js","names":["cosmwasmNs","strangeloveVenturesNs","osmosisNs","ibcNs"],"sources":["../src/lcd-adapter.ts"],"sourcesContent":["import { toBase64, toUtf8 } from '@cosmjs/encoding';\nimport {\n cosmos,\n cosmwasm as cosmwasmNs,\n ibc as ibcNs,\n liftedinit,\n osmosis as osmosisNs,\n strangelove_ventures as strangeloveVenturesNs,\n} from '@manifest-network/manifestjs';\nimport type { ManifestQueryClient } from './client.js';\nimport { logger } from './logger.js';\nimport { ManifestMCPError, ManifestMCPErrorCode } from './types.js';\n\nfunction snakeToCamel(s: string): string {\n return s.replace(/_(.)/g, (_, c: string) => c.toUpperCase());\n}\n\nfunction snakeToCamelDeep(obj: unknown): unknown {\n if (Array.isArray(obj)) {\n return obj.map(snakeToCamelDeep);\n }\n if (\n obj !== null &&\n typeof obj === 'object' &&\n !(obj instanceof Date) &&\n !(obj instanceof Uint8Array)\n ) {\n return Object.fromEntries(\n Object.entries(obj as Record<string, unknown>).map(([k, v]) => [\n snakeToCamel(k),\n snakeToCamelDeep(v),\n ]),\n );\n }\n return obj;\n}\n\nfunction ucFirst(s: string): string {\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n\ninterface Converter {\n fromJSON(object: unknown): unknown;\n}\n\nfunction findConverter(\n namespace: Record<string, unknown>,\n methodName: string,\n): Converter {\n const uc = ucFirst(methodName);\n const queryName = `Query${uc}Response`;\n const plainName = `${uc}Response`;\n\n const converter = (namespace[queryName] ?? namespace[plainName]) as\n | Converter\n | undefined;\n if (!converter?.fromJSON) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.QUERY_FAILED,\n `No response converter found for method \"${methodName}\" (tried \"${queryName}\" and \"${plainName}\")`,\n );\n }\n return converter;\n}\n\ntype AsyncFn = (...args: unknown[]) => Promise<unknown>;\n\nfunction adaptModule(\n lcdMod: unknown,\n converterNs: unknown,\n): Record<string, AsyncFn> {\n const lcdModule = lcdMod as Record<string, unknown>;\n const converterNamespace = converterNs as Record<string, unknown>;\n const adapted: Record<string, AsyncFn> = {};\n\n for (const key of Object.keys(lcdModule)) {\n if (key === 'req' || typeof lcdModule[key] !== 'function') continue;\n\n const originalFn = lcdModule[key] as AsyncFn;\n const converter = findConverter(converterNamespace, key);\n\n adapted[key] = async (...args: unknown[]) => {\n let sdkResult: unknown;\n try {\n sdkResult = await originalFn.call(lcdModule, ...args);\n } catch (error) {\n if (error instanceof ManifestMCPError) throw error;\n throw new ManifestMCPError(\n ManifestMCPErrorCode.QUERY_FAILED,\n `LCD query \"${key}\" failed: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n const camelCased = snakeToCamelDeep(sdkResult);\n try {\n return converter.fromJSON(camelCased);\n } catch (error) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.QUERY_FAILED,\n `Failed to convert LCD response for \"${key}\": ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n };\n }\n\n return adapted;\n}\n\nfunction unsupportedModule(modulePath: string): unknown {\n return new Proxy(\n {},\n {\n get(_target, prop) {\n if (typeof prop === 'string') {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.UNSUPPORTED_QUERY,\n `Module \"${modulePath}\" is not available via LCD/REST. Use an RPC endpoint instead.`,\n );\n }\n return undefined;\n },\n },\n );\n}\n\n/**\n * The generated LCD client interpolates `queryData` (Uint8Array) directly into\n * the URL path via template literal, producing comma-separated byte values\n * (e.g. `smart/123,34,99,...`) instead of base64. The REST API expects base64.\n * Patch the methods to convert queryData before the URL is constructed.\n */\nfunction patchWasmQueryData(wasmLcd: unknown): Record<string, unknown> {\n const mod = wasmLcd as Record<string, unknown>;\n const patched: Record<string, unknown> = { ...mod };\n for (const method of ['smartContractState', 'rawContractState']) {\n const original = mod[method] as (\n params: Record<string, unknown>,\n ) => Promise<unknown>;\n if (typeof original !== 'function') {\n logger.warn(\n `patchWasmQueryData: expected method \"${method}\" not found on wasm LCD module. Wasm queries may fail with malformed URLs.`,\n );\n continue;\n }\n patched[method] = async (params: Record<string, unknown>) => {\n const queryData = params.queryData;\n const result = (await original.call(mod, {\n ...params,\n queryData:\n queryData instanceof Uint8Array ? toBase64(queryData) : queryData,\n })) as Record<string, unknown>;\n\n // The LCD REST API returns `data` as a parsed JSON object, but the\n // protobuf `fromJSON` converter expects a base64 string representing\n // the UTF-8 bytes of the JSON payload. Re-encode so the adapter's\n // normal snakeToCamel → fromJSON pipeline works correctly.\n if (result.data != null && typeof result.data !== 'string') {\n return {\n ...result,\n data: toBase64(toUtf8(JSON.stringify(result.data))),\n };\n }\n return result;\n };\n }\n return patched;\n}\n\nexport async function createLCDQueryClient(\n restEndpoint: string,\n): Promise<ManifestQueryClient> {\n let lcd: Awaited<ReturnType<typeof liftedinit.ClientFactory.createLCDClient>>;\n let cosmwasmLcd: Awaited<\n ReturnType<typeof cosmwasmNs.ClientFactory.createLCDClient>\n >;\n let strangeloveLcd: Awaited<\n ReturnType<typeof strangeloveVenturesNs.ClientFactory.createLCDClient>\n >;\n let osmosisLcd: Awaited<\n ReturnType<typeof osmosisNs.ClientFactory.createLCDClient>\n >;\n let ibcLcd: Awaited<ReturnType<typeof ibcNs.ClientFactory.createLCDClient>>;\n try {\n [lcd, cosmwasmLcd, strangeloveLcd, osmosisLcd, ibcLcd] = await Promise.all([\n liftedinit.ClientFactory.createLCDClient({ restEndpoint }),\n cosmwasmNs.ClientFactory.createLCDClient({ restEndpoint }),\n strangeloveVenturesNs.ClientFactory.createLCDClient({ restEndpoint }),\n osmosisNs.ClientFactory.createLCDClient({ restEndpoint }),\n ibcNs.ClientFactory.createLCDClient({ restEndpoint }),\n ]);\n } catch (error) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.RPC_CONNECTION_FAILED,\n `Failed to create LCD client for ${restEndpoint}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n try {\n return {\n cosmos: {\n auth: {\n v1beta1: adaptModule(lcd.cosmos.auth.v1beta1, cosmos.auth.v1beta1),\n },\n authz: {\n v1beta1: adaptModule(lcd.cosmos.authz.v1beta1, cosmos.authz.v1beta1),\n },\n bank: {\n v1beta1: adaptModule(lcd.cosmos.bank.v1beta1, cosmos.bank.v1beta1),\n },\n base: {\n node: {\n v1beta1: adaptModule(\n lcd.cosmos.base.node.v1beta1,\n cosmos.base.node.v1beta1,\n ),\n },\n },\n circuit: { v1: adaptModule(lcd.cosmos.circuit.v1, cosmos.circuit.v1) },\n consensus: {\n v1: adaptModule(lcd.cosmos.consensus.v1, cosmos.consensus.v1),\n },\n distribution: {\n v1beta1: adaptModule(\n lcd.cosmos.distribution.v1beta1,\n cosmos.distribution.v1beta1,\n ),\n },\n feegrant: {\n v1beta1: adaptModule(\n lcd.cosmos.feegrant.v1beta1,\n cosmos.feegrant.v1beta1,\n ),\n },\n gov: {\n v1: adaptModule(lcd.cosmos.gov.v1, cosmos.gov.v1),\n v1beta1: adaptModule(lcd.cosmos.gov.v1beta1, cosmos.gov.v1beta1),\n },\n group: { v1: adaptModule(lcd.cosmos.group.v1, cosmos.group.v1) },\n mint: {\n v1beta1: adaptModule(lcd.cosmos.mint.v1beta1, cosmos.mint.v1beta1),\n },\n orm: {\n query: { v1alpha1: unsupportedModule('cosmos.orm.query.v1alpha1') },\n },\n params: {\n v1beta1: adaptModule(\n lcd.cosmos.params.v1beta1,\n cosmos.params.v1beta1,\n ),\n },\n staking: {\n v1beta1: adaptModule(\n lcd.cosmos.staking.v1beta1,\n cosmos.staking.v1beta1,\n ),\n },\n tx: { v1beta1: adaptModule(lcd.cosmos.tx.v1beta1, cosmos.tx.v1beta1) },\n upgrade: {\n v1beta1: adaptModule(\n lcd.cosmos.upgrade.v1beta1,\n cosmos.upgrade.v1beta1,\n ),\n },\n },\n liftedinit: {\n billing: {\n v1: adaptModule(lcd.liftedinit.billing.v1, liftedinit.billing.v1),\n },\n manifest: { v1: unsupportedModule('liftedinit.manifest.v1') },\n sku: { v1: adaptModule(lcd.liftedinit.sku.v1, liftedinit.sku.v1) },\n },\n cosmwasm: {\n wasm: {\n v1: adaptModule(\n patchWasmQueryData(cosmwasmLcd.cosmwasm.wasm.v1),\n cosmwasmNs.wasm.v1,\n ),\n },\n },\n strangelove_ventures: {\n poa: {\n v1: adaptModule(\n strangeloveLcd.strangelove_ventures.poa.v1,\n strangeloveVenturesNs.poa.v1,\n ),\n },\n },\n osmosis: {\n tokenfactory: {\n v1beta1: adaptModule(\n osmosisLcd.osmosis.tokenfactory.v1beta1,\n osmosisNs.tokenfactory.v1beta1,\n ),\n },\n },\n ibc: {\n applications: {\n transfer: {\n v1: adaptModule(\n ibcLcd.ibc.applications.transfer.v1,\n ibcNs.applications.transfer.v1,\n ),\n },\n },\n core: {\n channel: {\n v1: adaptModule(ibcLcd.ibc.core.channel.v1, ibcNs.core.channel.v1),\n },\n client: {\n v1: adaptModule(ibcLcd.ibc.core.client.v1, ibcNs.core.client.v1),\n },\n connection: {\n v1: adaptModule(\n ibcLcd.ibc.core.connection.v1,\n ibcNs.core.connection.v1,\n ),\n },\n },\n },\n } as ManifestQueryClient;\n } catch (error) {\n if (error instanceof ManifestMCPError) throw error;\n throw new ManifestMCPError(\n ManifestMCPErrorCode.RPC_CONNECTION_FAILED,\n `Failed to adapt LCD modules: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n}\n\n// Re-export for testing\nexport {\n adaptModule as _adaptModule,\n findConverter as _findConverter,\n patchWasmQueryData as _patchWasmQueryData,\n snakeToCamelDeep as _snakeToCamelDeep,\n unsupportedModule as _unsupportedModule,\n};\n"],"mappings":";;;;;AAaA,SAAS,aAAa,GAAmB;AACvC,QAAO,EAAE,QAAQ,UAAU,GAAG,MAAc,EAAE,aAAa,CAAC;;AAG9D,SAAS,iBAAiB,KAAuB;AAC/C,KAAI,MAAM,QAAQ,IAAI,CACpB,QAAO,IAAI,IAAI,iBAAiB;AAElC,KACE,QAAQ,QACR,OAAO,QAAQ,YACf,EAAE,eAAe,SACjB,EAAE,eAAe,YAEjB,QAAO,OAAO,YACZ,OAAO,QAAQ,IAA+B,CAAC,KAAK,CAAC,GAAG,OAAO,CAC7D,aAAa,EAAE,EACf,iBAAiB,EAAE,CACpB,CAAC,CACH;AAEH,QAAO;;AAGT,SAAS,QAAQ,GAAmB;AAClC,QAAO,EAAE,OAAO,EAAE,CAAC,aAAa,GAAG,EAAE,MAAM,EAAE;;AAO/C,SAAS,cACP,WACA,YACW;CACX,MAAM,KAAK,QAAQ,WAAW;CAC9B,MAAM,YAAY,QAAQ,GAAG;CAC7B,MAAM,YAAY,GAAG,GAAG;CAExB,MAAM,YAAa,UAAU,cAAc,UAAU;AAGrD,KAAI,CAAC,WAAW,SACd,OAAM,IAAI,iBACR,qBAAqB,cACrB,2CAA2C,WAAW,YAAY,UAAU,SAAS,UAAU,IAChG;AAEH,QAAO;;AAKT,SAAS,YACP,QACA,aACyB;CACzB,MAAM,YAAY;CAClB,MAAM,qBAAqB;CAC3B,MAAM,UAAmC,EAAE;AAE3C,MAAK,MAAM,OAAO,OAAO,KAAK,UAAU,EAAE;AACxC,MAAI,QAAQ,SAAS,OAAO,UAAU,SAAS,WAAY;EAE3D,MAAM,aAAa,UAAU;EAC7B,MAAM,YAAY,cAA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aAAa,SAAS,IACjCC,IAAM,aAAa,SAAS,GAC7B,EACF,EACF;IACD,MAAM;KACJ,SAAS,EACP,IAAI,YAAY,OAAO,IAAI,KAAK,QAAQ,IAAIA,IAAM,KAAK,QAAQ,GAAG,EACnE;KACD,QAAQ,EACN,IAAI,YAAY,OAAO,IAAI,KAAK,OAAO,IAAIA,IAAM,KAAK,OAAO,GAAG,EACjE;KACD,YAAY,EACV,IAAI,YACF,OAAO,IAAI,KAAK,WAAW,IAC3BA,IAAM,KAAK,WAAW,GACvB,EACF;KACF;IACF;GACF;UACM,OAAO;AACd,MAAI,iBAAiB,iBAAkB,OAAM;AAC7C,QAAM,IAAI,iBACR,qBAAqB,uBACrB,gCAAgC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GACvF"}
|
package/dist/logger.d.ts
CHANGED
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
* Leveled logger for MCP server processes.
|
|
4
4
|
*
|
|
5
5
|
* All output goes to stderr because stdout is reserved for MCP protocol messages.
|
|
6
|
-
* The level
|
|
7
|
-
* overridden at runtime via `logger.setLevel()`.
|
|
6
|
+
* The level defaults to `warn`; callers set it explicitly via `logger.setLevel()`.
|
|
8
7
|
*/
|
|
9
8
|
type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
9
|
+
/**
|
|
10
|
+
* Parse an untrusted string into a `LogLevel`. Returns `'warn'` for `undefined`,
|
|
11
|
+
* empty, or unrecognized values; emits a stderr warning on the unrecognized case.
|
|
12
|
+
* Node-specific env resolution lives in the node package's bootstrap.
|
|
13
|
+
*/
|
|
14
|
+
declare function parseLogLevel(raw: string | undefined): LogLevel;
|
|
10
15
|
declare const logger: {
|
|
11
16
|
debug(...args: unknown[]): void;
|
|
12
17
|
info(...args: unknown[]): void;
|
|
@@ -16,5 +21,5 @@ declare const logger: {
|
|
|
16
21
|
getLevel(): LogLevel;
|
|
17
22
|
};
|
|
18
23
|
//#endregion
|
|
19
|
-
export { LogLevel, logger };
|
|
24
|
+
export { LogLevel, logger, parseLogLevel };
|
|
20
25
|
//# sourceMappingURL=logger.d.ts.map
|
package/dist/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","names":[],"sources":["../src/logger.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","names":[],"sources":["../src/logger.ts"],"mappings":";;AAOA;;;;;KAAY,QAAA;;;;;AAgCZ;iBAfgB,aAAA,CAAc,GAAA,uBAA0B,QAAA;AAAA,cAe3C,MAAA;;;;;kBAaK,QAAA;cAGJ,QAAA;AAAA"}
|
package/dist/logger.js
CHANGED
|
@@ -6,14 +6,19 @@ const LOG_LEVEL_ORDER = {
|
|
|
6
6
|
error: 3,
|
|
7
7
|
silent: 4
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const VALID_LOG_LEVELS = new Set(Object.keys(LOG_LEVEL_ORDER));
|
|
10
|
+
/**
|
|
11
|
+
* Parse an untrusted string into a `LogLevel`. Returns `'warn'` for `undefined`,
|
|
12
|
+
* empty, or unrecognized values; emits a stderr warning on the unrecognized case.
|
|
13
|
+
* Node-specific env resolution lives in the node package's bootstrap.
|
|
14
|
+
*/
|
|
15
|
+
function parseLogLevel(raw) {
|
|
16
|
+
if (!raw) return "warn";
|
|
17
|
+
if (VALID_LOG_LEVELS.has(raw)) return raw;
|
|
18
|
+
console.error(`[WARN] Invalid LOG_LEVEL "${raw}". Valid values: debug, info, warn, error, silent. Defaulting to "warn".`);
|
|
14
19
|
return "warn";
|
|
15
20
|
}
|
|
16
|
-
let currentLevel =
|
|
21
|
+
let currentLevel = "warn";
|
|
17
22
|
function shouldLog(level) {
|
|
18
23
|
return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[currentLevel];
|
|
19
24
|
}
|
|
@@ -38,6 +43,6 @@ const logger = {
|
|
|
38
43
|
}
|
|
39
44
|
};
|
|
40
45
|
//#endregion
|
|
41
|
-
export { logger };
|
|
46
|
+
export { logger, parseLogLevel };
|
|
42
47
|
|
|
43
48
|
//# sourceMappingURL=logger.js.map
|
package/dist/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","names":[],"sources":["../src/logger.ts"],"sourcesContent":["/**\n * Leveled logger for MCP server processes.\n *\n * All output goes to stderr because stdout is reserved for MCP protocol messages.\n * The level
|
|
1
|
+
{"version":3,"file":"logger.js","names":[],"sources":["../src/logger.ts"],"sourcesContent":["/**\n * Leveled logger for MCP server processes.\n *\n * All output goes to stderr because stdout is reserved for MCP protocol messages.\n * The level defaults to `warn`; callers set it explicitly via `logger.setLevel()`.\n */\n\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';\n\nconst LOG_LEVEL_ORDER: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n silent: 4,\n};\n\nconst VALID_LOG_LEVELS = new Set<string>(Object.keys(LOG_LEVEL_ORDER));\n\n/**\n * Parse an untrusted string into a `LogLevel`. Returns `'warn'` for `undefined`,\n * empty, or unrecognized values; emits a stderr warning on the unrecognized case.\n * Node-specific env resolution lives in the node package's bootstrap.\n */\nexport function parseLogLevel(raw: string | undefined): LogLevel {\n if (!raw) return 'warn';\n if (VALID_LOG_LEVELS.has(raw)) return raw as LogLevel;\n console.error(\n `[WARN] Invalid LOG_LEVEL \"${raw}\". Valid values: debug, info, warn, error, silent. Defaulting to \"warn\".`,\n );\n return 'warn';\n}\n\nlet currentLevel: LogLevel = 'warn';\n\nfunction shouldLog(level: LogLevel): boolean {\n return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[currentLevel];\n}\n\nexport const logger = {\n debug(...args: unknown[]) {\n if (shouldLog('debug')) console.error('[DEBUG]', ...args);\n },\n info(...args: unknown[]) {\n if (shouldLog('info')) console.error('[INFO]', ...args);\n },\n warn(...args: unknown[]) {\n if (shouldLog('warn')) console.error('[WARN]', ...args);\n },\n error(...args: unknown[]) {\n if (shouldLog('error')) console.error('[ERROR]', ...args);\n },\n setLevel(level: LogLevel) {\n currentLevel = level;\n },\n getLevel(): LogLevel {\n return currentLevel;\n },\n};\n"],"mappings":";AASA,MAAM,kBAA4C;CAChD,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACP,QAAQ;CACT;AAED,MAAM,mBAAmB,IAAI,IAAY,OAAO,KAAK,gBAAgB,CAAC;;;;;;AAOtE,SAAgB,cAAc,KAAmC;AAC/D,KAAI,CAAC,IAAK,QAAO;AACjB,KAAI,iBAAiB,IAAI,IAAI,CAAE,QAAO;AACtC,SAAQ,MACN,6BAA6B,IAAI,0EAClC;AACD,QAAO;;AAGT,IAAI,eAAyB;AAE7B,SAAS,UAAU,OAA0B;AAC3C,QAAO,gBAAgB,UAAU,gBAAgB;;AAGnD,MAAa,SAAS;CACpB,MAAM,GAAG,MAAiB;AACxB,MAAI,UAAU,QAAQ,CAAE,SAAQ,MAAM,WAAW,GAAG,KAAK;;CAE3D,KAAK,GAAG,MAAiB;AACvB,MAAI,UAAU,OAAO,CAAE,SAAQ,MAAM,UAAU,GAAG,KAAK;;CAEzD,KAAK,GAAG,MAAiB;AACvB,MAAI,UAAU,OAAO,CAAE,SAAQ,MAAM,UAAU,GAAG,KAAK;;CAEzD,MAAM,GAAG,MAAiB;AACxB,MAAI,UAAU,QAAQ,CAAE,SAAQ,MAAM,WAAW,GAAG,KAAK;;CAE3D,SAAS,OAAiB;AACxB,iBAAe;;CAEjB,WAAqB;AACnB,SAAO;;CAEV"}
|
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":";;;;;;;AAiFA;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;;;;iBA+5Bc,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;AAv/BF;;;AAAA,iBAugCgB,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"}
|