@manifest-network/manifest-mcp-core 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__test-utils__/mocks.d.ts +1 -0
- package/dist/__test-utils__/mocks.d.ts.map +1 -1
- package/dist/__test-utils__/mocks.js +4 -1
- package/dist/__test-utils__/mocks.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/retry.d.ts.map +1 -1
- package/dist/retry.js +2 -1
- package/dist/retry.js.map +1 -1
- package/dist/sku-resolution.d.ts +38 -0
- package/dist/sku-resolution.d.ts.map +1 -0
- package/dist/sku-resolution.js +77 -0
- package/dist/sku-resolution.js.map +1 -0
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.d.ts","names":[],"sources":["../../src/__test-utils__/mocks.ts"],"mappings":";;;;;;;AAYA;iBAAgB,cAAA,CACd,SAAA,GAAY,OAAA,CAAQ,iBAAA,IACnB,iBAAA;;;;;iBAca,cAAA,CAAe,IAAA;EAC7B,aAAA;AAAA,IACE,cAAc;;;;UAiBR,gBAAA;EACR,QAAA;IAAa,KAAA;IAAe,MAAA;EAAA;EAC5B,aAAA;IACE,gBAAA;IACA,iBAAA;IACA,eAAA;MAAmB,KAAA;MAAe,MAAA;IAAA;EAAA;EAEpC,qBAAA;IAA0B,KAAA;IAAe,MAAA;EAAA;EACzC,8BAAA;IAAmC,KAAA;IAAe,MAAA;EAAA;EAClD,cAAA;IACE,cAAA;MAAkB,KAAA;MAAe,MAAA;IAAA;IACjC,kBAAA;MAAsB,KAAA;MAAe,MAAA;IAAA;IACrC,wBAAA;IACA,gBAAA;EAAA;EAEF,KAAA;IAC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O,UAAA;IACP,YAAA;IACA,SAAA,GAAY,IAAA;IACZ,QAAA,GAAW,IAAA;EAAA;EAEb,YAAA;IAAiB,IAAA;IAAc,YAAA;IAAsB,SAAA,GAAY,IAAA;EAAA;EACjE,aAAA;IAAkB,IAAA;IAAc,YAAA;IAAsB,SAAA,GAAY,IAAA;EAAA;EAClE,YAAA;IAAiB,IAAA;IAAc,YAAA;IAAsB,SAAA,GAAY,IAAA;EAAA;EACjE,cAAA;IAAmB,IAAA;IAAc,YAAA;IAAsB,SAAA,GAAY,IAAA;EAAA;EACnE,aAAA;IAAkB,IAAA;IAAc,YAAA;IAAsB,SAAA,GAAY,IAAA;EAAA;AAAA;AAAA,UAG1D,YAAA;EACR,SAAA;IACE,IAAA;IACA,OAAA;IACA,MAAA;IACA,MAAA;EAAA;EAEF,IAAA;IACE,IAAA;IACA,IAAA;IACA,YAAA;IACA,SAAA;MAAc,MAAA;MAAgB,KAAA;IAAA;IAC9B,MAAA;EAAA;EAEF,cAAA,GAAiB,MAAM;IAAW,QAAA;MAAY,MAAA;IAAA;EAAA;AAAA;;;;iBAMhC,mBAAA,CAAoB,SAAA;EAClC,OAAA,GAAU,gBAAA;EACV,GAAA,GAAM,YAAA;AAAA,IA8KU,mBAAA;;;;iBAMF,qBAAA,CAAsB,SAAA;EACpC,WAAA,GAAc,mBAAA;EACd,OAAA;EACA,MAAA,GAAS,iBAAiB;AAAA"}
|
|
@@ -166,7 +166,10 @@ function makeMockQueryClient(overrides) {
|
|
|
166
166
|
} },
|
|
167
167
|
sku: { v1: {
|
|
168
168
|
providers: vi.fn().mockResolvedValue({ providers }),
|
|
169
|
-
sKUs: vi.fn().mockResolvedValue({ skus
|
|
169
|
+
sKUs: vi.fn().mockResolvedValue({ skus: skus.map((s) => ({
|
|
170
|
+
active: true,
|
|
171
|
+
...s
|
|
172
|
+
})) }),
|
|
170
173
|
provider: vi.fn().mockImplementation(async ({ uuid }) => {
|
|
171
174
|
if (providerLookup[uuid]) return providerLookup[uuid];
|
|
172
175
|
throw new Error(`provider ${uuid} not found`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.js","names":[],"sources":["../../src/__test-utils__/mocks.ts"],"sourcesContent":["import { LeaseState } from '@manifest-network/manifestjs/dist/codegen/liftedinit/billing/v1/types.js';\nimport { vi } from 'vitest';\nimport type { ManifestQueryClient } from '../client.js';\nimport type {\n ManifestMCPConfig,\n SignArbitraryResult,\n WalletProvider,\n} from '../types.js';\n\n/**\n * Create a mock ManifestMCPConfig with sensible defaults.\n */\nexport function makeMockConfig(\n overrides?: Partial<ManifestMCPConfig>,\n): ManifestMCPConfig {\n return {\n chainId: 'test-chain',\n rpcUrl: 'https://rpc.example.com',\n gasPrice: '1.0umfx',\n addressPrefix: 'manifest',\n ...overrides,\n };\n}\n\n/**\n * Create a mock WalletProvider.\n * Pass `signArbitrary: true` to include a signArbitrary stub.\n */\nexport function makeMockWallet(opts?: {\n signArbitrary?: boolean;\n}): WalletProvider {\n const wallet: WalletProvider = {\n getAddress: vi.fn().mockResolvedValue('manifest1abc'),\n getSigner: vi.fn().mockResolvedValue({}),\n };\n if (opts?.signArbitrary) {\n wallet.signArbitrary = vi.fn().mockResolvedValue({\n pub_key: { type: 'tendermint/PubKeySecp256k1', value: 'mockPubKey' },\n signature: 'mockSignature',\n } satisfies SignArbitraryResult);\n }\n return wallet;\n}\n\n/**\n * Billing mock data defaults\n */\ninterface BillingOverrides {\n balances?: { denom: string; amount: string }[];\n creditAccount?: {\n activeLeaseCount: bigint;\n pendingLeaseCount: bigint;\n reservedAmounts: { denom: string; amount: string }[];\n } | null;\n creditAccountBalances?: { denom: string; amount: string }[];\n creditAccountAvailableBalances?: { denom: string; amount: string }[];\n creditEstimate?: {\n currentBalance: { denom: string; amount: string }[];\n totalRatePerSecond: { denom: string; amount: string }[];\n estimatedDurationSeconds: bigint;\n activeLeaseCount: bigint;\n } | null;\n lease?: {\n uuid: string;\n state: LeaseState;\n providerUuid: string;\n createdAt?: Date;\n closedAt?: Date;\n } | null;\n activeLeases?: { uuid: string; providerUuid: string; createdAt?: Date }[];\n pendingLeases?: { uuid: string; providerUuid: string; createdAt?: Date }[];\n closedLeases?: { uuid: string; providerUuid: string; createdAt?: Date }[];\n rejectedLeases?: { uuid: string; providerUuid: string; createdAt?: Date }[];\n expiredLeases?: { uuid: string; providerUuid: string; createdAt?: Date }[];\n}\n\ninterface SkuOverrides {\n providers?: {\n uuid: string;\n address: string;\n apiUrl: string;\n active: boolean;\n }[];\n skus?: {\n uuid?: string;\n name: string;\n providerUuid: string;\n basePrice?: { amount: string; denom: string };\n }[];\n providerLookup?: Record<string, { provider: { apiUrl: string } }>;\n}\n\n/**\n * Create a mock ManifestQueryClient with configurable billing, bank, and SKU data.\n */\nexport function makeMockQueryClient(overrides?: {\n billing?: BillingOverrides;\n sku?: SkuOverrides;\n}) {\n const billing = overrides?.billing ?? {};\n const sku = overrides?.sku ?? {};\n\n const balances = billing.balances ?? [{ denom: 'umfx', amount: '1000000' }];\n const creditAccount = billing.creditAccount ?? null;\n const creditAccountBalances = billing.creditAccountBalances ?? [];\n const creditAccountAvailableBalances =\n billing.creditAccountAvailableBalances ?? [];\n const creditEstimate = billing.creditEstimate ?? null;\n const lease = billing.lease ?? null;\n const activeLeases = billing.activeLeases ?? [];\n const pendingLeases = billing.pendingLeases ?? [];\n const closedLeases = billing.closedLeases ?? [];\n const rejectedLeases = billing.rejectedLeases ?? [];\n const expiredLeases = billing.expiredLeases ?? [];\n\n const providers = sku.providers ?? [];\n const skus = sku.skus ?? [];\n const providerLookup = sku.providerLookup ?? {};\n\n return {\n cosmos: {\n bank: {\n v1beta1: {\n allBalances: vi.fn().mockResolvedValue({ balances }),\n },\n },\n },\n cosmwasm: {\n wasm: {\n v1: {\n contractInfo: vi.fn().mockResolvedValue({}),\n contractHistory: vi\n .fn()\n .mockResolvedValue({ entries: [], pagination: null }),\n contractsByCode: vi\n .fn()\n .mockResolvedValue({ contracts: [], pagination: null }),\n allContractState: vi\n .fn()\n .mockResolvedValue({ models: [], pagination: null }),\n rawContractState: vi\n .fn()\n .mockResolvedValue({ data: new Uint8Array() }),\n smartContractState: vi\n .fn()\n .mockResolvedValue({ data: new Uint8Array() }),\n code: vi\n .fn()\n .mockResolvedValue({ codeInfo: null, data: new Uint8Array() }),\n codes: vi.fn().mockResolvedValue({ codeInfos: [], pagination: null }),\n codeInfo: vi.fn().mockResolvedValue({\n codeId: BigInt(0),\n creator: '',\n checksum: new Uint8Array(),\n instantiatePermission: { permission: 0, addresses: [] },\n }),\n pinnedCodes: vi\n .fn()\n .mockResolvedValue({ codeIds: [], pagination: null }),\n params: vi.fn().mockResolvedValue({ params: null }),\n contractsByCreator: vi\n .fn()\n .mockResolvedValue({ contractAddresses: [], pagination: null }),\n wasmLimitsConfig: vi.fn().mockResolvedValue({ config: '{}' }),\n buildAddress: vi.fn().mockResolvedValue({ address: '' }),\n },\n },\n },\n liftedinit: {\n billing: {\n v1: {\n creditAccount: vi.fn().mockImplementation(async () => {\n if (creditAccount === null) throw new Error('key not found');\n return {\n creditAccount,\n balances: creditAccountBalances,\n availableBalances: creditAccountAvailableBalances,\n };\n }),\n creditEstimate: vi.fn().mockImplementation(async () => {\n if (creditEstimate === null) throw new Error('credit not found');\n return creditEstimate;\n }),\n lease: vi.fn().mockImplementation(async () => {\n return { lease };\n }),\n leasesByTenant: vi\n .fn()\n .mockImplementation(\n async ({ stateFilter }: { stateFilter: LeaseState }) => {\n if (stateFilter === LeaseState.LEASE_STATE_UNSPECIFIED) {\n return {\n leases: [\n ...activeLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_ACTIVE,\n ...l,\n })),\n ...pendingLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_PENDING,\n ...l,\n })),\n ...closedLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_CLOSED,\n ...l,\n })),\n ...rejectedLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_REJECTED,\n ...l,\n })),\n ...expiredLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_EXPIRED,\n ...l,\n })),\n ],\n };\n }\n if (stateFilter === LeaseState.LEASE_STATE_ACTIVE)\n return {\n leases: activeLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_ACTIVE,\n ...l,\n })),\n };\n if (stateFilter === LeaseState.LEASE_STATE_PENDING)\n return {\n leases: pendingLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_PENDING,\n ...l,\n })),\n };\n if (stateFilter === LeaseState.LEASE_STATE_CLOSED)\n return {\n leases: closedLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_CLOSED,\n ...l,\n })),\n };\n if (stateFilter === LeaseState.LEASE_STATE_REJECTED)\n return {\n leases: rejectedLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_REJECTED,\n ...l,\n })),\n };\n if (stateFilter === LeaseState.LEASE_STATE_EXPIRED)\n return {\n leases: expiredLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_EXPIRED,\n ...l,\n })),\n };\n return { leases: [] };\n },\n ),\n },\n },\n sku: {\n v1: {\n providers: vi.fn().mockResolvedValue({ providers }),\n sKUs: vi.fn().mockResolvedValue({ skus }),\n provider: vi\n .fn()\n .mockImplementation(async ({ uuid }: { uuid: string }) => {\n if (providerLookup[uuid]) return providerLookup[uuid];\n throw new Error(`provider ${uuid} not found`);\n }),\n },\n },\n },\n } as unknown as ManifestQueryClient;\n}\n\n/**\n * Create a mock CosmosClientManager.\n */\nexport function makeMockClientManager(overrides?: {\n queryClient?: ManifestQueryClient;\n address?: string;\n config?: ManifestMCPConfig;\n}) {\n const queryClient = overrides?.queryClient ?? makeMockQueryClient();\n const address = overrides?.address ?? 'manifest1abc';\n const config = overrides?.config ?? makeMockConfig();\n\n return {\n getQueryClient: vi.fn().mockResolvedValue(queryClient),\n getSigningClient: vi.fn().mockResolvedValue({}),\n getAddress: vi.fn().mockResolvedValue(address),\n getConfig: vi.fn().mockReturnValue(config),\n acquireRateLimit: vi.fn().mockResolvedValue(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,OAAO,EACL,QAAQ,eAAe,KAAK,OAAO;MACjC,OAAO,WAAW;MAClB,GAAG;KACL,EAAE,EACJ;KACF,IAAI,gBAAgB,WAAW,qBAC7B,OAAO,EACL,QAAQ,cAAc,KAAK,OAAO;MAChC,OAAO,WAAW;MAClB,GAAG;KACL,EAAE,EACJ;KACF,OAAO,EAAE,QAAQ,CAAC,EAAE;IACtB,CACF;GACJ,EACF;GACA,KAAK,EACH,IAAI;IACF,WAAW,GAAG,GAAG,EAAE,kBAAkB,EAAE,UAAU,CAAC;IAClD,MAAM,GAAG,GAAG,EAAE,kBAAkB,EAAE,KAAK,CAAC;IACxC,UAAU,GACP,GAAG,EACH,mBAAmB,OAAO,EAAE,WAA6B;KACxD,IAAI,eAAe,OAAO,OAAO,eAAe;KAChD,MAAM,IAAI,MAAM,YAAY,KAAK,WAAW;IAC9C,CAAC;GACL,EACF;EACF;CACF;AACF;;;;AAKA,SAAgB,sBAAsB,WAInC;CACD,MAAM,cAAc,WAAW,eAAe,oBAAoB;CAClE,MAAM,UAAU,WAAW,WAAW;CACtC,MAAM,SAAS,WAAW,UAAU,eAAe;CAEnD,OAAO;EACL,gBAAgB,GAAG,GAAG,EAAE,kBAAkB,WAAW;EACrD,kBAAkB,GAAG,GAAG,EAAE,kBAAkB,CAAC,CAAC;EAC9C,YAAY,GAAG,GAAG,EAAE,kBAAkB,OAAO;EAC7C,WAAW,GAAG,GAAG,EAAE,gBAAgB,MAAM;EACzC,kBAAkB,GAAG,GAAG,EAAE,kBAAkB,KAAA,CAAS;EACrD,YAAY,GAAG,GAAG;CACpB;AACF"}
|
|
1
|
+
{"version":3,"file":"mocks.js","names":[],"sources":["../../src/__test-utils__/mocks.ts"],"sourcesContent":["import { LeaseState } from '@manifest-network/manifestjs/dist/codegen/liftedinit/billing/v1/types.js';\nimport { vi } from 'vitest';\nimport type { ManifestQueryClient } from '../client.js';\nimport type {\n ManifestMCPConfig,\n SignArbitraryResult,\n WalletProvider,\n} from '../types.js';\n\n/**\n * Create a mock ManifestMCPConfig with sensible defaults.\n */\nexport function makeMockConfig(\n overrides?: Partial<ManifestMCPConfig>,\n): ManifestMCPConfig {\n return {\n chainId: 'test-chain',\n rpcUrl: 'https://rpc.example.com',\n gasPrice: '1.0umfx',\n addressPrefix: 'manifest',\n ...overrides,\n };\n}\n\n/**\n * Create a mock WalletProvider.\n * Pass `signArbitrary: true` to include a signArbitrary stub.\n */\nexport function makeMockWallet(opts?: {\n signArbitrary?: boolean;\n}): WalletProvider {\n const wallet: WalletProvider = {\n getAddress: vi.fn().mockResolvedValue('manifest1abc'),\n getSigner: vi.fn().mockResolvedValue({}),\n };\n if (opts?.signArbitrary) {\n wallet.signArbitrary = vi.fn().mockResolvedValue({\n pub_key: { type: 'tendermint/PubKeySecp256k1', value: 'mockPubKey' },\n signature: 'mockSignature',\n } satisfies SignArbitraryResult);\n }\n return wallet;\n}\n\n/**\n * Billing mock data defaults\n */\ninterface BillingOverrides {\n balances?: { denom: string; amount: string }[];\n creditAccount?: {\n activeLeaseCount: bigint;\n pendingLeaseCount: bigint;\n reservedAmounts: { denom: string; amount: string }[];\n } | null;\n creditAccountBalances?: { denom: string; amount: string }[];\n creditAccountAvailableBalances?: { denom: string; amount: string }[];\n creditEstimate?: {\n currentBalance: { denom: string; amount: string }[];\n totalRatePerSecond: { denom: string; amount: string }[];\n estimatedDurationSeconds: bigint;\n activeLeaseCount: bigint;\n } | null;\n lease?: {\n uuid: string;\n state: LeaseState;\n providerUuid: string;\n createdAt?: Date;\n closedAt?: Date;\n } | null;\n activeLeases?: { uuid: string; providerUuid: string; createdAt?: Date }[];\n pendingLeases?: { uuid: string; providerUuid: string; createdAt?: Date }[];\n closedLeases?: { uuid: string; providerUuid: string; createdAt?: Date }[];\n rejectedLeases?: { uuid: string; providerUuid: string; createdAt?: Date }[];\n expiredLeases?: { uuid: string; providerUuid: string; createdAt?: Date }[];\n}\n\ninterface SkuOverrides {\n providers?: {\n uuid: string;\n address: string;\n apiUrl: string;\n active: boolean;\n }[];\n skus?: {\n uuid?: string;\n name: string;\n providerUuid: string;\n basePrice?: { amount: string; denom: string };\n active?: boolean;\n }[];\n providerLookup?: Record<string, { provider: { apiUrl: string } }>;\n}\n\n/**\n * Create a mock ManifestQueryClient with configurable billing, bank, and SKU data.\n */\nexport function makeMockQueryClient(overrides?: {\n billing?: BillingOverrides;\n sku?: SkuOverrides;\n}) {\n const billing = overrides?.billing ?? {};\n const sku = overrides?.sku ?? {};\n\n const balances = billing.balances ?? [{ denom: 'umfx', amount: '1000000' }];\n const creditAccount = billing.creditAccount ?? null;\n const creditAccountBalances = billing.creditAccountBalances ?? [];\n const creditAccountAvailableBalances =\n billing.creditAccountAvailableBalances ?? [];\n const creditEstimate = billing.creditEstimate ?? null;\n const lease = billing.lease ?? null;\n const activeLeases = billing.activeLeases ?? [];\n const pendingLeases = billing.pendingLeases ?? [];\n const closedLeases = billing.closedLeases ?? [];\n const rejectedLeases = billing.rejectedLeases ?? [];\n const expiredLeases = billing.expiredLeases ?? [];\n\n const providers = sku.providers ?? [];\n const skus = sku.skus ?? [];\n const providerLookup = sku.providerLookup ?? {};\n\n return {\n cosmos: {\n bank: {\n v1beta1: {\n allBalances: vi.fn().mockResolvedValue({ balances }),\n },\n },\n },\n cosmwasm: {\n wasm: {\n v1: {\n contractInfo: vi.fn().mockResolvedValue({}),\n contractHistory: vi\n .fn()\n .mockResolvedValue({ entries: [], pagination: null }),\n contractsByCode: vi\n .fn()\n .mockResolvedValue({ contracts: [], pagination: null }),\n allContractState: vi\n .fn()\n .mockResolvedValue({ models: [], pagination: null }),\n rawContractState: vi\n .fn()\n .mockResolvedValue({ data: new Uint8Array() }),\n smartContractState: vi\n .fn()\n .mockResolvedValue({ data: new Uint8Array() }),\n code: vi\n .fn()\n .mockResolvedValue({ codeInfo: null, data: new Uint8Array() }),\n codes: vi.fn().mockResolvedValue({ codeInfos: [], pagination: null }),\n codeInfo: vi.fn().mockResolvedValue({\n codeId: BigInt(0),\n creator: '',\n checksum: new Uint8Array(),\n instantiatePermission: { permission: 0, addresses: [] },\n }),\n pinnedCodes: vi\n .fn()\n .mockResolvedValue({ codeIds: [], pagination: null }),\n params: vi.fn().mockResolvedValue({ params: null }),\n contractsByCreator: vi\n .fn()\n .mockResolvedValue({ contractAddresses: [], pagination: null }),\n wasmLimitsConfig: vi.fn().mockResolvedValue({ config: '{}' }),\n buildAddress: vi.fn().mockResolvedValue({ address: '' }),\n },\n },\n },\n liftedinit: {\n billing: {\n v1: {\n creditAccount: vi.fn().mockImplementation(async () => {\n if (creditAccount === null) throw new Error('key not found');\n return {\n creditAccount,\n balances: creditAccountBalances,\n availableBalances: creditAccountAvailableBalances,\n };\n }),\n creditEstimate: vi.fn().mockImplementation(async () => {\n if (creditEstimate === null) throw new Error('credit not found');\n return creditEstimate;\n }),\n lease: vi.fn().mockImplementation(async () => {\n return { lease };\n }),\n leasesByTenant: vi\n .fn()\n .mockImplementation(\n async ({ stateFilter }: { stateFilter: LeaseState }) => {\n if (stateFilter === LeaseState.LEASE_STATE_UNSPECIFIED) {\n return {\n leases: [\n ...activeLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_ACTIVE,\n ...l,\n })),\n ...pendingLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_PENDING,\n ...l,\n })),\n ...closedLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_CLOSED,\n ...l,\n })),\n ...rejectedLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_REJECTED,\n ...l,\n })),\n ...expiredLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_EXPIRED,\n ...l,\n })),\n ],\n };\n }\n if (stateFilter === LeaseState.LEASE_STATE_ACTIVE)\n return {\n leases: activeLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_ACTIVE,\n ...l,\n })),\n };\n if (stateFilter === LeaseState.LEASE_STATE_PENDING)\n return {\n leases: pendingLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_PENDING,\n ...l,\n })),\n };\n if (stateFilter === LeaseState.LEASE_STATE_CLOSED)\n return {\n leases: closedLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_CLOSED,\n ...l,\n })),\n };\n if (stateFilter === LeaseState.LEASE_STATE_REJECTED)\n return {\n leases: rejectedLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_REJECTED,\n ...l,\n })),\n };\n if (stateFilter === LeaseState.LEASE_STATE_EXPIRED)\n return {\n leases: expiredLeases.map((l) => ({\n state: LeaseState.LEASE_STATE_EXPIRED,\n ...l,\n })),\n };\n return { leases: [] };\n },\n ),\n },\n },\n sku: {\n v1: {\n providers: vi.fn().mockResolvedValue({ providers }),\n sKUs: vi.fn().mockResolvedValue({\n skus: skus.map((s) => ({ active: true, ...s })),\n }),\n provider: vi\n .fn()\n .mockImplementation(async ({ uuid }: { uuid: string }) => {\n if (providerLookup[uuid]) return providerLookup[uuid];\n throw new Error(`provider ${uuid} not found`);\n }),\n },\n },\n },\n } as unknown as ManifestQueryClient;\n}\n\n/**\n * Create a mock CosmosClientManager.\n */\nexport function makeMockClientManager(overrides?: {\n queryClient?: ManifestQueryClient;\n address?: string;\n config?: ManifestMCPConfig;\n}) {\n const queryClient = overrides?.queryClient ?? makeMockQueryClient();\n const address = overrides?.address ?? 'manifest1abc';\n const config = overrides?.config ?? makeMockConfig();\n\n return {\n getQueryClient: vi.fn().mockResolvedValue(queryClient),\n getSigningClient: vi.fn().mockResolvedValue({}),\n getAddress: vi.fn().mockResolvedValue(address),\n getConfig: vi.fn().mockReturnValue(config),\n acquireRateLimit: vi.fn().mockResolvedValue(undefined),\n disconnect: vi.fn(),\n };\n}\n"],"mappings":";;;;;;AAYA,SAAgB,eACd,WACmB;CACnB,OAAO;EACL,SAAS;EACT,QAAQ;EACR,UAAU;EACV,eAAe;EACf,GAAG;CACL;AACF;;;;;AAMA,SAAgB,eAAe,MAEZ;CACjB,MAAM,SAAyB;EAC7B,YAAY,GAAG,GAAG,EAAE,kBAAkB,cAAc;EACpD,WAAW,GAAG,G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KAAK,EACH,IAAI;IACF,WAAW,GAAG,GAAG,EAAE,kBAAkB,EAAE,UAAU,CAAC;IAClD,MAAM,GAAG,GAAG,EAAE,kBAAkB,EAC9B,MAAM,KAAK,KAAK,OAAO;KAAE,QAAQ;KAAM,GAAG;IAAE,EAAE,EAChD,CAAC;IACD,UAAU,GACP,GAAG,EACH,mBAAmB,OAAO,EAAE,WAA6B;KACxD,IAAI,eAAe,OAAO,OAAO,eAAe;KAChD,MAAM,IAAI,MAAM,YAAY,KAAK,WAAW;IAC9C,CAAC;GACL,EACF;EACF;CACF;AACF;;;;AAKA,SAAgB,sBAAsB,WAInC;CACD,MAAM,cAAc,WAAW,eAAe,oBAAoB;CAClE,MAAM,UAAU,WAAW,WAAW;CACtC,MAAM,SAAS,WAAW,UAAU,eAAe;CAEnD,OAAO;EACL,gBAAgB,GAAG,GAAG,EAAE,kBAAkB,WAAW;EACrD,kBAAkB,GAAG,GAAG,EAAE,kBAAkB,CAAC,CAAC;EAC9C,YAAY,GAAG,GAAG,EAAE,kBAAkB,OAAO;EAC7C,WAAW,GAAG,GAAG,EAAE,gBAAgB,MAAM;EACzC,kBAAkB,GAAG,GAAG,EAAE,kBAAkB,KAAA,CAAS;EACrD,YAAY,GAAG,GAAG;CACpB;AACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { getAvailableModules, getModuleSubcommands, getSubcommandUsage, getSuppo
|
|
|
10
10
|
import { validateAddress } from "./transactions/utils.js";
|
|
11
11
|
import { MAX_PAGE_LIMIT, createPagination } from "./queries/utils.js";
|
|
12
12
|
import { INFRASTRUCTURE_ERROR_CODES, ManifestMCPServerOptions, MnemonicServerConfig, SENSITIVE_FIELDS, bigIntReplacer, createMnemonicServer, jsonResponse, sanitizeForLogging, structuredResponse, withErrorHandling } from "./server-utils.js";
|
|
13
|
+
import { ResolveSkuInput, SkuCandidate, listSkuCandidates, resolveSku } from "./sku-resolution.js";
|
|
13
14
|
import { MANIFEST_TOOL_META_VERSION, ManifestToolMeta, ManifestToolMetaContainer, ManifestToolMetaVersion, manifestMeta, mutatingAnnotations, readOnlyAnnotations } from "./tool-metadata.js";
|
|
14
15
|
import { FundCreditsResult, fundCredits } from "./tools/fundCredits.js";
|
|
15
16
|
import { getBalance } from "./tools/getBalance.js";
|
|
@@ -20,4 +21,4 @@ import { VERSION } from "./version.js";
|
|
|
20
21
|
import { MnemonicWalletProvider } from "./wallet/mnemonic.js";
|
|
21
22
|
import { signArbitraryWithAmino } from "./wallet/sign-arbitrary.js";
|
|
22
23
|
import { LeaseState, leaseStateFromJSON, leaseStateToJSON } from "@manifest-network/manifestjs/dist/codegen/liftedinit/billing/v1/types.js";
|
|
23
|
-
export { AccountInfo, AccountInfoResult, AddressBytesToStringResult, AddressStringToBytesResult, type Any, AuthAccountResult, AuthAccountsResult, type AuthParams, AuthParamsResult, type AuthzGrant, type AuthzGrantAuthorization, AuthzGranteeGrantsResult, AuthzGranterGrantsResult, AuthzGrantsResult, AvailableModules, BalanceResult, BalancesResult, type BankMetadata, type BankParams, BankParamsResult, type BaseAccount, Bech32PrefixResult, type BillingParams, BillingParamsResult, BuiltMessages, type CodeInfoResponse, Coin, CommissionResult, CommunityPoolResult, type ContractCodeHistoryEntry, type ContractInfo, CosmosClientManager, CosmosQueryResult, CosmosTxResult, type CreditAccount, CreditAccountResult, CreditAccountsResult, CreditAddressResult, CreditEstimateResult, DEFAULT_RETRY_CONFIG, DNS_LABEL_RE, DecCoin, type DelegationDelegatorReward, type DelegationResponse, DelegationResult, DelegationsResult, DelegatorValidatorsResult, DelegatorWithdrawAddressResult, type DenomAuthorityMetadata, DenomAuthorityMetadataResult, DenomMetadataResult, type DenomTrace, DenomsFromAdminResult, DenomsFromCreatorResult, DenomsMetadataResult, type DepositParams, DepositResult, DepositsResult, type DistributionParams, DistributionParamsResult, FeeEstimateResult, FeegrantAllowanceResult, FeegrantAllowancesResult, type FeegrantGrant, type FundCreditsResult, type GovDeposit, type GovParams, GovParamsResult, type GovProposal, type GovTallyResult, type GovVote, type GroupInfo, GroupInfoResult, type GroupMember, GroupMembersResult, GroupPoliciesResult, type GroupPolicyInfo, GroupPolicyInfoResult, type GroupProposal, GroupProposalResult, GroupProposalsResult, GroupTallyQueryResult, type GroupTallyResult, type GroupVote, GroupVoteResult, GroupVotesResult, GroupsResult, type HistoricalInfo, HistoricalInfoResult, INFRASTRUCTURE_ERROR_CODES, IbcDenomTraceResult, IbcDenomTracesResult, type IbcTransferParams, IbcTransferParamsResult, type Lease, LeaseByCustomDomainResult, type 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, type MintParams, MintParamsResult, type MnemonicServerConfig, MnemonicWalletProvider, type Model, type ModuleAccount, ModuleAccountsResult, ModuleInfo, PaginatedResult, PaginationResponse, PoAAuthorityResult, PoAConsensusPowerResult, PoAPendingValidatorsResult, type PoAStakingParams, type PoAValidator, ProposalResult, ProposalsResult, type Provider, ProviderResult, ProviderWithdrawableResult, ProvidersResult, type QueryCreditEstimateResponse, QueryResult, RateLimitConfig, type RedelegationResponse, RedelegationsResult, RetryConfig, type RetryOptions, RewardsResult, SENSITIVE_FIELDS, type SKU, type SendEnabled, SendEnabledResult, type SetItemCustomDomainOptions, type SetItemCustomDomainResult, SignArbitraryResult, type SkuParams, SkuParamsResult, SkuResult, SkusResult, SlashesResult, type StakingParams, StakingParamsResult, type StakingPool, StakingPoolResult, type StopAppResult, SupplyOfResult, type TallyParams, TallyResult, type TokenfactoryParams, TokenfactoryParamsResult, TotalSupplyResult, TxBuildContext, TxOptions, TxOverrides, type UnbondingDelegation, UnbondingDelegationResult, UnbondingDelegationsResult, VERSION, type ValidationResult, type Validator, type ValidatorAccumulatedCommission, type ValidatorOutstandingRewards, ValidatorOutstandingRewardsResult, ValidatorResult, type ValidatorSlashEvent, ValidatorsResult, VoteResult, VotesResult, type VotingParams, WalletProvider, WasmAllContractStateResult, WasmBuildAddressResult, WasmCodeInfo, WasmCodeInfoResult, WasmCodeResult, WasmCodesResult, WasmContractHistoryResult, WasmContractInfoResult, WasmContractsByCodeResult, WasmContractsByCreatorResult, WasmLimitsConfigResult, type 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, parseBooleanEnv, parseLogLevel, readOnlyAnnotations, requireString, requireStringEnum, requireUuid, sanitizeForLogging, setItemCustomDomain, signArbitraryWithAmino, stopApp, structuredResponse, validateAddress, validateConfig, validateEndpointUrl, withErrorHandling, withRetry };
|
|
24
|
+
export { AccountInfo, AccountInfoResult, AddressBytesToStringResult, AddressStringToBytesResult, type Any, AuthAccountResult, AuthAccountsResult, type AuthParams, AuthParamsResult, type AuthzGrant, type AuthzGrantAuthorization, AuthzGranteeGrantsResult, AuthzGranterGrantsResult, AuthzGrantsResult, AvailableModules, BalanceResult, BalancesResult, type BankMetadata, type BankParams, BankParamsResult, type BaseAccount, Bech32PrefixResult, type BillingParams, BillingParamsResult, BuiltMessages, type CodeInfoResponse, Coin, CommissionResult, CommunityPoolResult, type ContractCodeHistoryEntry, type ContractInfo, CosmosClientManager, CosmosQueryResult, CosmosTxResult, type CreditAccount, CreditAccountResult, CreditAccountsResult, CreditAddressResult, CreditEstimateResult, DEFAULT_RETRY_CONFIG, DNS_LABEL_RE, DecCoin, type DelegationDelegatorReward, type DelegationResponse, DelegationResult, DelegationsResult, DelegatorValidatorsResult, DelegatorWithdrawAddressResult, type DenomAuthorityMetadata, DenomAuthorityMetadataResult, DenomMetadataResult, type DenomTrace, DenomsFromAdminResult, DenomsFromCreatorResult, DenomsMetadataResult, type DepositParams, DepositResult, DepositsResult, type DistributionParams, DistributionParamsResult, FeeEstimateResult, FeegrantAllowanceResult, FeegrantAllowancesResult, type FeegrantGrant, type FundCreditsResult, type GovDeposit, type GovParams, GovParamsResult, type GovProposal, type GovTallyResult, type GovVote, type GroupInfo, GroupInfoResult, type GroupMember, GroupMembersResult, GroupPoliciesResult, type GroupPolicyInfo, GroupPolicyInfoResult, type GroupProposal, GroupProposalResult, GroupProposalsResult, GroupTallyQueryResult, type GroupTallyResult, type GroupVote, GroupVoteResult, GroupVotesResult, GroupsResult, type HistoricalInfo, HistoricalInfoResult, INFRASTRUCTURE_ERROR_CODES, IbcDenomTraceResult, IbcDenomTracesResult, type IbcTransferParams, IbcTransferParamsResult, type Lease, LeaseByCustomDomainResult, type 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, type MintParams, MintParamsResult, type MnemonicServerConfig, MnemonicWalletProvider, type Model, type ModuleAccount, ModuleAccountsResult, ModuleInfo, PaginatedResult, PaginationResponse, PoAAuthorityResult, PoAConsensusPowerResult, PoAPendingValidatorsResult, type PoAStakingParams, type PoAValidator, ProposalResult, ProposalsResult, type Provider, ProviderResult, ProviderWithdrawableResult, ProvidersResult, type QueryCreditEstimateResponse, QueryResult, RateLimitConfig, type RedelegationResponse, RedelegationsResult, type ResolveSkuInput, RetryConfig, type RetryOptions, RewardsResult, SENSITIVE_FIELDS, type SKU, type SendEnabled, SendEnabledResult, type SetItemCustomDomainOptions, type SetItemCustomDomainResult, SignArbitraryResult, type SkuCandidate, type SkuParams, SkuParamsResult, SkuResult, SkusResult, SlashesResult, type StakingParams, StakingParamsResult, type StakingPool, StakingPoolResult, type StopAppResult, SupplyOfResult, type TallyParams, TallyResult, type TokenfactoryParams, TokenfactoryParamsResult, TotalSupplyResult, TxBuildContext, TxOptions, TxOverrides, type UnbondingDelegation, UnbondingDelegationResult, UnbondingDelegationsResult, VERSION, type ValidationResult, type Validator, type ValidatorAccumulatedCommission, type ValidatorOutstandingRewards, ValidatorOutstandingRewardsResult, ValidatorResult, type ValidatorSlashEvent, ValidatorsResult, VoteResult, VotesResult, type VotingParams, WalletProvider, WasmAllContractStateResult, WasmBuildAddressResult, WasmCodeInfo, WasmCodeInfoResult, WasmCodeResult, WasmCodesResult, WasmContractHistoryResult, WasmContractInfoResult, WasmContractsByCodeResult, WasmContractsByCreatorResult, WasmLimitsConfigResult, type 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, listSkuCandidates, logger, manifestMeta, mutatingAnnotations, optionalBoolean, parseArgs, parseBooleanEnv, parseLogLevel, readOnlyAnnotations, requireString, requireStringEnum, requireUuid, resolveSku, sanitizeForLogging, setItemCustomDomain, signArbitraryWithAmino, stopApp, structuredResponse, validateAddress, validateConfig, validateEndpointUrl, withErrorHandling, withRetry };
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import { signArbitraryWithAmino } from "./wallet/sign-arbitrary.js";
|
|
|
14
14
|
import { MnemonicWalletProvider } from "./wallet/mnemonic.js";
|
|
15
15
|
import "./wallet/index.js";
|
|
16
16
|
import { INFRASTRUCTURE_ERROR_CODES, SENSITIVE_FIELDS, bigIntReplacer, createMnemonicServer, jsonResponse, sanitizeForLogging, structuredResponse, withErrorHandling } from "./server-utils.js";
|
|
17
|
+
import { listSkuCandidates, resolveSku } from "./sku-resolution.js";
|
|
17
18
|
import { MANIFEST_TOOL_META_VERSION, manifestMeta, mutatingAnnotations, readOnlyAnnotations } from "./tool-metadata.js";
|
|
18
19
|
import { fundCredits } from "./tools/fundCredits.js";
|
|
19
20
|
import { getBalance } from "./tools/getBalance.js";
|
|
@@ -21,4 +22,4 @@ import { setItemCustomDomain } from "./tools/setItemCustomDomain.js";
|
|
|
21
22
|
import { stopApp } from "./tools/stopApp.js";
|
|
22
23
|
import { VERSION } from "./version.js";
|
|
23
24
|
import { LeaseState, leaseStateFromJSON, leaseStateToJSON } from "@manifest-network/manifestjs/dist/codegen/liftedinit/billing/v1/types.js";
|
|
24
|
-
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, parseBooleanEnv, parseLogLevel, readOnlyAnnotations, requireString, requireStringEnum, requireUuid, sanitizeForLogging, setItemCustomDomain, signArbitraryWithAmino, stopApp, structuredResponse, validateAddress, validateConfig, validateEndpointUrl, withErrorHandling, withRetry };
|
|
25
|
+
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, listSkuCandidates, logger, manifestMeta, mutatingAnnotations, optionalBoolean, parseArgs, parseBooleanEnv, parseLogLevel, readOnlyAnnotations, requireString, requireStringEnum, requireUuid, resolveSku, sanitizeForLogging, setItemCustomDomain, signArbitraryWithAmino, stopApp, structuredResponse, validateAddress, validateConfig, validateEndpointUrl, withErrorHandling, withRetry };
|
package/dist/retry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.d.ts","names":[],"sources":["../src/retry.ts"],"mappings":";;;;cAOa,oBAAA,EAAsB,QAAQ,CAAC,WAAA;AAA5C;;;AAAA,
|
|
1
|
+
{"version":3,"file":"retry.d.ts","names":[],"sources":["../src/retry.ts"],"mappings":";;;;cAOa,oBAAA,EAAsB,QAAQ,CAAC,WAAA;AAA5C;;;AAAA,iBAyFgB,gBAAA,CAAiB,KAAc;AAzFQ;AAyFvD;;;;AAA+C;AA0B/C;AAnHuD,iBAmHvC,gBAAA,CACd,OAAA,UACA,WAAA,UACA,UAAA;;;;UAwBe,YAAA;EAxBf;EA0BA,MAAA,GAAS,WAAW;EA1BF;EA4BlB,aAAA;EAJ2B;EAM3B,OAAA,IAAW,KAAA,WAAgB,OAAA,UAAiB,OAAA;AAAA;;;;;;;;;AAAe;AAmB7D;;;;;;;iBAAsB,SAAA,IACpB,SAAA,QAAiB,OAAA,CAAQ,CAAA,GACzB,OAAA,GAAS,YAAA,GACR,OAAA,CAAQ,CAAA"}
|
package/dist/retry.js
CHANGED
|
@@ -19,7 +19,8 @@ const NON_RETRYABLE_ERROR_CODES = [
|
|
|
19
19
|
"UNSUPPORTED_QUERY",
|
|
20
20
|
"UNKNOWN_MODULE",
|
|
21
21
|
"TX_FAILED",
|
|
22
|
-
"OPERATION_CANCELLED"
|
|
22
|
+
"OPERATION_CANCELLED",
|
|
23
|
+
"SKU_AMBIGUOUS"
|
|
23
24
|
];
|
|
24
25
|
/**
|
|
25
26
|
* Check if an error message indicates a transient failure that should be retried.
|
package/dist/retry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.js","names":[],"sources":["../src/retry.ts"],"sourcesContent":["import {\n ManifestMCPError,\n ManifestMCPErrorCode,\n type RetryConfig,\n} from './types.js';\n\n/** Default retry configuration */\nexport const DEFAULT_RETRY_CONFIG: Required<RetryConfig> = {\n maxRetries: 3,\n baseDelayMs: 1000,\n maxDelayMs: 10000,\n};\n\n/**\n * Error codes that should NOT be retried (permanent failures)\n */\nconst NON_RETRYABLE_ERROR_CODES: ManifestMCPErrorCode[] = [\n // Configuration errors - won't change on retry\n ManifestMCPErrorCode.INVALID_CONFIG,\n\n // Wallet errors - require user action\n ManifestMCPErrorCode.WALLET_NOT_CONNECTED,\n ManifestMCPErrorCode.WALLET_CONNECTION_FAILED,\n ManifestMCPErrorCode.INVALID_MNEMONIC,\n\n // Validation errors - input is invalid\n ManifestMCPErrorCode.INVALID_ADDRESS,\n ManifestMCPErrorCode.UNSUPPORTED_TX,\n ManifestMCPErrorCode.UNSUPPORTED_QUERY,\n ManifestMCPErrorCode.UNKNOWN_MODULE,\n\n // Transaction failures - on-chain rejection. Retrying could cause\n // double-spend for non-idempotent operations.\n ManifestMCPErrorCode.TX_FAILED,\n\n // User-action errors - a deliberate decline / cancel / elicitation-timeout.\n // Retrying a user's cancel is nonsensical (ENG-272).\n ManifestMCPErrorCode.OPERATION_CANCELLED,\n];\n\n/**\n * Check if an error message indicates a transient failure that should be retried.\n *\n * Uses specific patterns to avoid false positives (e.g. \"proposal 500\" matching\n * bare \"500\", or \"connection to validator not authorized\" matching \"connection\").\n */\nfunction isTransientErrorMessage(message: string): boolean {\n const lowerMessage = message.toLowerCase();\n\n // Node.js / system error codes (specific, no false positives)\n if (\n lowerMessage.includes('econnrefused') ||\n lowerMessage.includes('econnreset') ||\n lowerMessage.includes('etimedout') ||\n lowerMessage.includes('enotfound') ||\n lowerMessage.includes('epipe') ||\n lowerMessage.includes('socket hang up') ||\n lowerMessage.includes('timed out') ||\n lowerMessage.includes('network request failed') ||\n lowerMessage.includes('fetch failed')\n ) {\n return true;\n }\n\n // HTTP 5xx errors — match \"HTTP 5xx\" or \"status 5xx\" patterns, not bare numbers\n if (/\\b(?:http|status)\\s*5\\d{2}\\b/.test(lowerMessage)) {\n return true;\n }\n\n // HTTP 5xx descriptive strings\n if (\n lowerMessage.includes('internal server error') ||\n lowerMessage.includes('bad gateway') ||\n lowerMessage.includes('service unavailable') ||\n lowerMessage.includes('gateway timeout')\n ) {\n return true;\n }\n\n // Rate limiting\n if (\n /\\b429\\b/.test(lowerMessage) ||\n lowerMessage.includes('too many requests')\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Determine if an error is retryable\n */\nexport function isRetryableError(error: unknown): boolean {\n // ManifestMCPError with non-retryable code\n if (error instanceof ManifestMCPError) {\n if (NON_RETRYABLE_ERROR_CODES.includes(error.code)) {\n return false;\n }\n // Check message for transient indicators\n return isTransientErrorMessage(error.message);\n }\n\n // Standard Error - check message\n if (error instanceof Error) {\n return isTransientErrorMessage(error.message);\n }\n\n // Unknown error type - don't retry\n return false;\n}\n\n/**\n * Calculate delay with exponential backoff and jitter\n * @param attempt - Current attempt number (0-indexed)\n * @param baseDelayMs - Base delay in milliseconds\n * @param maxDelayMs - Maximum delay cap\n * @returns Delay in milliseconds\n */\nexport function calculateBackoff(\n attempt: number,\n baseDelayMs: number,\n maxDelayMs: number,\n): number {\n // Exponential backoff: baseDelay * 2^attempt\n const exponentialDelay = baseDelayMs * 2 ** attempt;\n\n // Cap at max delay\n const cappedDelay = Math.min(exponentialDelay, maxDelayMs);\n\n // Add jitter (±25% randomization to prevent thundering herd)\n const jitter = cappedDelay * 0.25 * (Math.random() * 2 - 1);\n\n return Math.floor(cappedDelay + jitter);\n}\n\n/**\n * Sleep for a given number of milliseconds\n */\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Options for the retry wrapper\n */\nexport interface RetryOptions {\n /** Retry configuration */\n config?: RetryConfig;\n /** Operation name for error messages */\n operationName?: string;\n /** Callback invoked before each retry attempt */\n onRetry?: (error: unknown, attempt: number, delayMs: number) => void;\n}\n\n/**\n * Execute an async operation with retry logic for transient failures\n *\n * @param operation - Async function to execute\n * @param options - Retry options\n * @returns Result of the operation\n * @throws The last error if all retries are exhausted\n *\n * @example\n * ```typescript\n * const result = await withRetry(\n * () => fetchData(),\n * { config: { maxRetries: 3 }, operationName: 'fetchData' }\n * );\n * ```\n */\nexport async function withRetry<T>(\n operation: () => Promise<T>,\n options: RetryOptions = {},\n): Promise<T> {\n const config = {\n ...DEFAULT_RETRY_CONFIG,\n ...options.config,\n };\n\n let lastError: unknown;\n\n for (let attempt = 0; attempt <= config.maxRetries; attempt++) {\n try {\n return await operation();\n } catch (error) {\n lastError = error;\n\n // Check if we should retry\n const isLastAttempt = attempt === config.maxRetries;\n const shouldRetry = !isLastAttempt && isRetryableError(error);\n\n if (!shouldRetry) {\n throw error;\n }\n\n // Calculate backoff delay\n const delayMs = calculateBackoff(\n attempt,\n config.baseDelayMs,\n config.maxDelayMs,\n );\n\n // Notify callback if provided\n if (options.onRetry) {\n options.onRetry(error, attempt + 1, delayMs);\n }\n\n // Wait before retrying\n await sleep(delayMs);\n }\n }\n\n // This should never be reached, but TypeScript needs it\n throw lastError;\n}\n"],"mappings":";;;AAOA,MAAa,uBAA8C;CACzD,YAAY;CACZ,aAAa;CACb,YAAY;AACd;;;;AAKA,MAAM,4BAAoD
|
|
1
|
+
{"version":3,"file":"retry.js","names":[],"sources":["../src/retry.ts"],"sourcesContent":["import {\n ManifestMCPError,\n ManifestMCPErrorCode,\n type RetryConfig,\n} from './types.js';\n\n/** Default retry configuration */\nexport const DEFAULT_RETRY_CONFIG: Required<RetryConfig> = {\n maxRetries: 3,\n baseDelayMs: 1000,\n maxDelayMs: 10000,\n};\n\n/**\n * Error codes that should NOT be retried (permanent failures)\n */\nconst NON_RETRYABLE_ERROR_CODES: ManifestMCPErrorCode[] = [\n // Configuration errors - won't change on retry\n ManifestMCPErrorCode.INVALID_CONFIG,\n\n // Wallet errors - require user action\n ManifestMCPErrorCode.WALLET_NOT_CONNECTED,\n ManifestMCPErrorCode.WALLET_CONNECTION_FAILED,\n ManifestMCPErrorCode.INVALID_MNEMONIC,\n\n // Validation errors - input is invalid\n ManifestMCPErrorCode.INVALID_ADDRESS,\n ManifestMCPErrorCode.UNSUPPORTED_TX,\n ManifestMCPErrorCode.UNSUPPORTED_QUERY,\n ManifestMCPErrorCode.UNKNOWN_MODULE,\n\n // Transaction failures - on-chain rejection. Retrying could cause\n // double-spend for non-idempotent operations.\n ManifestMCPErrorCode.TX_FAILED,\n\n // User-action errors - a deliberate decline / cancel / elicitation-timeout.\n // Retrying a user's cancel is nonsensical (ENG-272).\n ManifestMCPErrorCode.OPERATION_CANCELLED,\n\n // SKU resolution - ambiguous name needs caller disambiguation, not retry\n ManifestMCPErrorCode.SKU_AMBIGUOUS,\n];\n\n/**\n * Check if an error message indicates a transient failure that should be retried.\n *\n * Uses specific patterns to avoid false positives (e.g. \"proposal 500\" matching\n * bare \"500\", or \"connection to validator not authorized\" matching \"connection\").\n */\nfunction isTransientErrorMessage(message: string): boolean {\n const lowerMessage = message.toLowerCase();\n\n // Node.js / system error codes (specific, no false positives)\n if (\n lowerMessage.includes('econnrefused') ||\n lowerMessage.includes('econnreset') ||\n lowerMessage.includes('etimedout') ||\n lowerMessage.includes('enotfound') ||\n lowerMessage.includes('epipe') ||\n lowerMessage.includes('socket hang up') ||\n lowerMessage.includes('timed out') ||\n lowerMessage.includes('network request failed') ||\n lowerMessage.includes('fetch failed')\n ) {\n return true;\n }\n\n // HTTP 5xx errors — match \"HTTP 5xx\" or \"status 5xx\" patterns, not bare numbers\n if (/\\b(?:http|status)\\s*5\\d{2}\\b/.test(lowerMessage)) {\n return true;\n }\n\n // HTTP 5xx descriptive strings\n if (\n lowerMessage.includes('internal server error') ||\n lowerMessage.includes('bad gateway') ||\n lowerMessage.includes('service unavailable') ||\n lowerMessage.includes('gateway timeout')\n ) {\n return true;\n }\n\n // Rate limiting\n if (\n /\\b429\\b/.test(lowerMessage) ||\n lowerMessage.includes('too many requests')\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Determine if an error is retryable\n */\nexport function isRetryableError(error: unknown): boolean {\n // ManifestMCPError with non-retryable code\n if (error instanceof ManifestMCPError) {\n if (NON_RETRYABLE_ERROR_CODES.includes(error.code)) {\n return false;\n }\n // Check message for transient indicators\n return isTransientErrorMessage(error.message);\n }\n\n // Standard Error - check message\n if (error instanceof Error) {\n return isTransientErrorMessage(error.message);\n }\n\n // Unknown error type - don't retry\n return false;\n}\n\n/**\n * Calculate delay with exponential backoff and jitter\n * @param attempt - Current attempt number (0-indexed)\n * @param baseDelayMs - Base delay in milliseconds\n * @param maxDelayMs - Maximum delay cap\n * @returns Delay in milliseconds\n */\nexport function calculateBackoff(\n attempt: number,\n baseDelayMs: number,\n maxDelayMs: number,\n): number {\n // Exponential backoff: baseDelay * 2^attempt\n const exponentialDelay = baseDelayMs * 2 ** attempt;\n\n // Cap at max delay\n const cappedDelay = Math.min(exponentialDelay, maxDelayMs);\n\n // Add jitter (±25% randomization to prevent thundering herd)\n const jitter = cappedDelay * 0.25 * (Math.random() * 2 - 1);\n\n return Math.floor(cappedDelay + jitter);\n}\n\n/**\n * Sleep for a given number of milliseconds\n */\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Options for the retry wrapper\n */\nexport interface RetryOptions {\n /** Retry configuration */\n config?: RetryConfig;\n /** Operation name for error messages */\n operationName?: string;\n /** Callback invoked before each retry attempt */\n onRetry?: (error: unknown, attempt: number, delayMs: number) => void;\n}\n\n/**\n * Execute an async operation with retry logic for transient failures\n *\n * @param operation - Async function to execute\n * @param options - Retry options\n * @returns Result of the operation\n * @throws The last error if all retries are exhausted\n *\n * @example\n * ```typescript\n * const result = await withRetry(\n * () => fetchData(),\n * { config: { maxRetries: 3 }, operationName: 'fetchData' }\n * );\n * ```\n */\nexport async function withRetry<T>(\n operation: () => Promise<T>,\n options: RetryOptions = {},\n): Promise<T> {\n const config = {\n ...DEFAULT_RETRY_CONFIG,\n ...options.config,\n };\n\n let lastError: unknown;\n\n for (let attempt = 0; attempt <= config.maxRetries; attempt++) {\n try {\n return await operation();\n } catch (error) {\n lastError = error;\n\n // Check if we should retry\n const isLastAttempt = attempt === config.maxRetries;\n const shouldRetry = !isLastAttempt && isRetryableError(error);\n\n if (!shouldRetry) {\n throw error;\n }\n\n // Calculate backoff delay\n const delayMs = calculateBackoff(\n attempt,\n config.baseDelayMs,\n config.maxDelayMs,\n );\n\n // Notify callback if provided\n if (options.onRetry) {\n options.onRetry(error, attempt + 1, delayMs);\n }\n\n // Wait before retrying\n await sleep(delayMs);\n }\n }\n\n // This should never be reached, but TypeScript needs it\n throw lastError;\n}\n"],"mappings":";;;AAOA,MAAa,uBAA8C;CACzD,YAAY;CACZ,aAAa;CACb,YAAY;AACd;;;;AAKA,MAAM,4BAAoD;;;;;;;;;;;;AAyB1D;;;;;;;AAQA,SAAS,wBAAwB,SAA0B;CACzD,MAAM,eAAe,QAAQ,YAAY;CAGzC,IACE,aAAa,SAAS,cAAc,KACpC,aAAa,SAAS,YAAY,KAClC,aAAa,SAAS,WAAW,KACjC,aAAa,SAAS,WAAW,KACjC,aAAa,SAAS,O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AU,iBACd,SACA,OAAO,aACP,OAAO,UACT;EAGA,IAAI,QAAQ,SACV,QAAQ,QAAQ,OAAO,UAAU,GAAG,OAAO;EAI7C,MAAM,MAAM,OAAO;CACrB;CAIF,MAAM;AACR"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ManifestQueryClient } from "./client.js";
|
|
2
|
+
|
|
3
|
+
//#region src/sku-resolution.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A single concrete SKU. `skuUuid` is the immutable identity; `name` is a
|
|
6
|
+
* free-form, NON-unique label (the chain enforces no name uniqueness).
|
|
7
|
+
*/
|
|
8
|
+
interface SkuCandidate {
|
|
9
|
+
readonly skuUuid: string;
|
|
10
|
+
readonly providerUuid: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly price?: {
|
|
13
|
+
readonly amount: string;
|
|
14
|
+
readonly denom: string;
|
|
15
|
+
};
|
|
16
|
+
readonly active: boolean;
|
|
17
|
+
}
|
|
18
|
+
interface ResolveSkuInput {
|
|
19
|
+
/** User-facing tier name. Always supplied; used for matching + error messages. */
|
|
20
|
+
readonly size: string;
|
|
21
|
+
/** Narrow name matches to one provider. */
|
|
22
|
+
readonly providerUuid?: string;
|
|
23
|
+
/** Bypass name lookup entirely; wins over size/providerUuid. */
|
|
24
|
+
readonly skuUuid?: string;
|
|
25
|
+
}
|
|
26
|
+
/** List every active SKU matching `size` (optionally narrowed by provider). No throw on >1. */
|
|
27
|
+
declare function listSkuCandidates(queryClient: ManifestQueryClient, size: string, providerUuid?: string): Promise<SkuCandidate[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Resolve a SKU intent to a single concrete SKU. See the design spec §4.1.
|
|
30
|
+
*
|
|
31
|
+
* - `skuUuid` given → find it among active SKUs; validate `providerUuid` if also given.
|
|
32
|
+
* - else by name → 0 → QUERY_FAILED (lists names); 1 → return; >1 → SKU_AMBIGUOUS.
|
|
33
|
+
* With `providerUuid`, narrow first; same-provider duplicates → SKU_AMBIGUOUS (require sku_uuid).
|
|
34
|
+
*/
|
|
35
|
+
declare function resolveSku(queryClient: ManifestQueryClient, input: ResolveSkuInput): Promise<SkuCandidate>;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { ResolveSkuInput, SkuCandidate, listSkuCandidates, resolveSku };
|
|
38
|
+
//# sourceMappingURL=sku-resolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sku-resolution.d.ts","names":[],"sources":["../src/sku-resolution.ts"],"mappings":";;;;;AAQA;;UAAiB,YAAA;EAAA,SACN,OAAA;EAAA,SACA,YAAA;EAAA,SACA,IAAA;EAAA,SACA,KAAA;IAAA,SAAmB,MAAA;IAAA,SAAyB,KAAA;EAAA;EAAA,SAC5C,MAAA;AAAA;AAAA,UAGM,eAAA;EAAA;EAAA,SAEN,IAAA;;WAEA,YAAA;EAFA;EAAA,SAIA,OAAA;AAAA;;iBAiCW,iBAAA,CACpB,WAAA,EAAa,mBAAA,EACb,IAAA,UACA,YAAA,YACC,OAAA,CAAQ,YAAA;AAJX;;;;;;;AAAA,iBAsCsB,UAAA,CACpB,WAAA,EAAa,mBAAA,EACb,KAAA,EAAO,eAAA,GACN,OAAA,CAAQ,YAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ManifestMCPError } from "./types.js";
|
|
2
|
+
import { MAX_PAGE_LIMIT, createPagination } from "./queries/utils.js";
|
|
3
|
+
//#region src/sku-resolution.ts
|
|
4
|
+
function toCandidate(s) {
|
|
5
|
+
return {
|
|
6
|
+
skuUuid: s.uuid,
|
|
7
|
+
providerUuid: s.providerUuid,
|
|
8
|
+
name: s.name,
|
|
9
|
+
...s.basePrice ? { price: {
|
|
10
|
+
amount: s.basePrice.amount,
|
|
11
|
+
denom: s.basePrice.denom
|
|
12
|
+
} } : {},
|
|
13
|
+
active: s.active ?? true
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
async function fetchActiveSkus(queryClient) {
|
|
17
|
+
const pagination = createPagination(MAX_PAGE_LIMIT);
|
|
18
|
+
return (await queryClient.liftedinit.sku.v1.sKUs({
|
|
19
|
+
activeOnly: true,
|
|
20
|
+
pagination
|
|
21
|
+
})).skus.map(toCandidate);
|
|
22
|
+
}
|
|
23
|
+
/** List every active SKU matching `size` (optionally narrowed by provider). No throw on >1. */
|
|
24
|
+
async function listSkuCandidates(queryClient, size, providerUuid) {
|
|
25
|
+
const sizeTrimmed = size.trim();
|
|
26
|
+
const providerUuidTrimmed = providerUuid?.trim() || void 0;
|
|
27
|
+
let named = (await fetchActiveSkus(queryClient)).filter((s) => s.name === sizeTrimmed);
|
|
28
|
+
if (providerUuidTrimmed !== void 0) named = named.filter((s) => s.providerUuid === providerUuidTrimmed);
|
|
29
|
+
return named;
|
|
30
|
+
}
|
|
31
|
+
function ambiguous(size, candidates) {
|
|
32
|
+
const lines = candidates.map((c) => ` - ${c.name} (sku_uuid=${c.skuUuid}, provider_uuid=${c.providerUuid}${c.price ? `, price=${c.price.amount} ${c.price.denom}` : ""})`).join("\n");
|
|
33
|
+
return new ManifestMCPError("SKU_AMBIGUOUS", `SKU name "${size}" matches ${candidates.length} active SKUs. Specify provider_uuid (or sku_uuid) to disambiguate:\n${lines}`, {
|
|
34
|
+
reason: "AMBIGUOUS_SKU_NAME",
|
|
35
|
+
size,
|
|
36
|
+
candidates
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolve a SKU intent to a single concrete SKU. See the design spec §4.1.
|
|
41
|
+
*
|
|
42
|
+
* - `skuUuid` given → find it among active SKUs; validate `providerUuid` if also given.
|
|
43
|
+
* - else by name → 0 → QUERY_FAILED (lists names); 1 → return; >1 → SKU_AMBIGUOUS.
|
|
44
|
+
* With `providerUuid`, narrow first; same-provider duplicates → SKU_AMBIGUOUS (require sku_uuid).
|
|
45
|
+
*/
|
|
46
|
+
async function resolveSku(queryClient, input) {
|
|
47
|
+
const skuUuid = input.skuUuid?.trim() || void 0;
|
|
48
|
+
const providerUuid = input.providerUuid?.trim() || void 0;
|
|
49
|
+
const size = input.size.trim();
|
|
50
|
+
const all = await fetchActiveSkus(queryClient);
|
|
51
|
+
if (skuUuid !== void 0) {
|
|
52
|
+
const hit = all.find((s) => s.skuUuid === skuUuid);
|
|
53
|
+
if (!hit) throw new ManifestMCPError("QUERY_FAILED", `SKU uuid "${skuUuid}" not found among active SKUs.`);
|
|
54
|
+
if (providerUuid !== void 0 && providerUuid !== hit.providerUuid) throw new ManifestMCPError("INVALID_CONFIG", `sku_uuid ${skuUuid} belongs to provider ${hit.providerUuid}, not the requested provider_uuid ${providerUuid}.`);
|
|
55
|
+
return hit;
|
|
56
|
+
}
|
|
57
|
+
const named = all.filter((s) => s.name === size);
|
|
58
|
+
if (named.length === 0) {
|
|
59
|
+
const names = [...new Set(all.map((s) => s.name))];
|
|
60
|
+
const MAX_SHOWN = 20;
|
|
61
|
+
const shown = names.slice(0, MAX_SHOWN).join(", ");
|
|
62
|
+
const more = names.length > MAX_SHOWN ? ` (+${names.length - MAX_SHOWN} more; ${names.length} total)` : "";
|
|
63
|
+
throw new ManifestMCPError("QUERY_FAILED", `SKU tier "${size}" not found on any provider. ${names.length === 0 ? "No active SKUs exist on this chain." : `Available: ${shown}${more}`}`);
|
|
64
|
+
}
|
|
65
|
+
if (providerUuid !== void 0) {
|
|
66
|
+
const onProvider = named.filter((s) => s.providerUuid === providerUuid);
|
|
67
|
+
if (onProvider.length === 0) throw new ManifestMCPError("QUERY_FAILED", `SKU tier "${size}" is not offered by provider ${providerUuid}. Offered by: ${[...new Set(named.map((s) => s.providerUuid))].join(", ")}.`);
|
|
68
|
+
if (onProvider.length > 1) throw ambiguous(size, onProvider);
|
|
69
|
+
return onProvider[0];
|
|
70
|
+
}
|
|
71
|
+
if (named.length > 1) throw ambiguous(size, named);
|
|
72
|
+
return named[0];
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { listSkuCandidates, resolveSku };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=sku-resolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sku-resolution.js","names":[],"sources":["../src/sku-resolution.ts"],"sourcesContent":["import type { ManifestQueryClient } from './client.js';\nimport { createPagination, MAX_PAGE_LIMIT } from './queries/utils.js';\nimport { ManifestMCPError, ManifestMCPErrorCode } from './types.js';\n\n/**\n * A single concrete SKU. `skuUuid` is the immutable identity; `name` is a\n * free-form, NON-unique label (the chain enforces no name uniqueness).\n */\nexport interface SkuCandidate {\n readonly skuUuid: string;\n readonly providerUuid: string;\n readonly name: string;\n readonly price?: { readonly amount: string; readonly denom: string };\n readonly active: boolean;\n}\n\nexport interface ResolveSkuInput {\n /** User-facing tier name. Always supplied; used for matching + error messages. */\n readonly size: string;\n /** Narrow name matches to one provider. */\n readonly providerUuid?: string;\n /** Bypass name lookup entirely; wins over size/providerUuid. */\n readonly skuUuid?: string;\n}\n\nfunction toCandidate(s: {\n uuid: string;\n name: string;\n providerUuid: string;\n basePrice?: { amount: string; denom: string };\n active?: boolean;\n}): SkuCandidate {\n return {\n skuUuid: s.uuid,\n providerUuid: s.providerUuid,\n name: s.name,\n ...(s.basePrice\n ? { price: { amount: s.basePrice.amount, denom: s.basePrice.denom } }\n : {}),\n active: s.active ?? true,\n };\n}\n\nasync function fetchActiveSkus(\n queryClient: ManifestQueryClient,\n): Promise<SkuCandidate[]> {\n const pagination = createPagination(MAX_PAGE_LIMIT);\n const result = await queryClient.liftedinit.sku.v1.sKUs({\n activeOnly: true,\n pagination,\n });\n return result.skus.map(toCandidate);\n}\n\n/** List every active SKU matching `size` (optionally narrowed by provider). No throw on >1. */\nexport async function listSkuCandidates(\n queryClient: ManifestQueryClient,\n size: string,\n providerUuid?: string,\n): Promise<SkuCandidate[]> {\n const sizeTrimmed = size.trim();\n const providerUuidTrimmed = providerUuid?.trim() || undefined;\n const all = await fetchActiveSkus(queryClient);\n let named = all.filter((s) => s.name === sizeTrimmed);\n if (providerUuidTrimmed !== undefined) {\n named = named.filter((s) => s.providerUuid === providerUuidTrimmed);\n }\n return named;\n}\n\nfunction ambiguous(size: string, candidates: SkuCandidate[]): ManifestMCPError {\n const lines = candidates\n .map(\n (c) =>\n ` - ${c.name} (sku_uuid=${c.skuUuid}, provider_uuid=${c.providerUuid}` +\n `${c.price ? `, price=${c.price.amount} ${c.price.denom}` : ''})`,\n )\n .join('\\n');\n return new ManifestMCPError(\n ManifestMCPErrorCode.SKU_AMBIGUOUS,\n `SKU name \"${size}\" matches ${candidates.length} active SKUs. ` +\n `Specify provider_uuid (or sku_uuid) to disambiguate:\\n${lines}`,\n { reason: 'AMBIGUOUS_SKU_NAME', size, candidates },\n );\n}\n\n/**\n * Resolve a SKU intent to a single concrete SKU. See the design spec §4.1.\n *\n * - `skuUuid` given → find it among active SKUs; validate `providerUuid` if also given.\n * - else by name → 0 → QUERY_FAILED (lists names); 1 → return; >1 → SKU_AMBIGUOUS.\n * With `providerUuid`, narrow first; same-provider duplicates → SKU_AMBIGUOUS (require sku_uuid).\n */\nexport async function resolveSku(\n queryClient: ManifestQueryClient,\n input: ResolveSkuInput,\n): Promise<SkuCandidate> {\n const skuUuid = input.skuUuid?.trim() || undefined;\n const providerUuid = input.providerUuid?.trim() || undefined;\n const size = input.size.trim();\n const all = await fetchActiveSkus(queryClient);\n\n if (skuUuid !== undefined) {\n const hit = all.find((s) => s.skuUuid === skuUuid);\n if (!hit) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.QUERY_FAILED,\n `SKU uuid \"${skuUuid}\" not found among active SKUs.`,\n );\n }\n if (providerUuid !== undefined && providerUuid !== hit.providerUuid) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.INVALID_CONFIG,\n `sku_uuid ${skuUuid} belongs to provider ${hit.providerUuid}, ` +\n `not the requested provider_uuid ${providerUuid}.`,\n );\n }\n return hit;\n }\n\n const named = all.filter((s) => s.name === size);\n if (named.length === 0) {\n const names = [...new Set(all.map((s) => s.name))];\n const MAX_SHOWN = 20;\n const shown = names.slice(0, MAX_SHOWN).join(', ');\n const more =\n names.length > MAX_SHOWN\n ? ` (+${names.length - MAX_SHOWN} more; ${names.length} total)`\n : '';\n const available =\n names.length === 0\n ? 'No active SKUs exist on this chain.'\n : `Available: ${shown}${more}`;\n throw new ManifestMCPError(\n ManifestMCPErrorCode.QUERY_FAILED,\n `SKU tier \"${size}\" not found on any provider. ${available}`,\n );\n }\n\n if (providerUuid !== undefined) {\n const onProvider = named.filter((s) => s.providerUuid === providerUuid);\n if (onProvider.length === 0) {\n throw new ManifestMCPError(\n ManifestMCPErrorCode.QUERY_FAILED,\n `SKU tier \"${size}\" is not offered by provider ${providerUuid}. ` +\n `Offered by: ${[...new Set(named.map((s) => s.providerUuid))].join(', ')}.`,\n );\n }\n if (onProvider.length > 1) throw ambiguous(size, onProvider);\n return onProvider[0];\n }\n\n if (named.length > 1) throw ambiguous(size, named);\n return named[0];\n}\n"],"mappings":";;;AAyBA,SAAS,YAAY,GAMJ;CACf,OAAO;EACL,SAAS,EAAE;EACX,cAAc,EAAE;EAChB,MAAM,EAAE;EACR,GAAI,EAAE,YACF,EAAE,OAAO;GAAE,QAAQ,EAAE,UAAU;GAAQ,OAAO,EAAE,UAAU;EAAM,EAAE,IAClE,CAAC;EACL,QAAQ,EAAE,UAAU;CACtB;AACF;AAEA,eAAe,gBACb,aACyB;CACzB,MAAM,aAAa,iBAAiB,cAAc;CAKlD,QAAO,MAJc,YAAY,WAAW,IAAI,GAAG,KAAK;EACtD,YAAY;EACZ;CACF,CAAC,GACa,KAAK,IAAI,WAAW;AACpC;;AAGA,eAAsB,kBACpB,aACA,MACA,cACyB;CACzB,MAAM,cAAc,KAAK,KAAK;CAC9B,MAAM,sBAAsB,cAAc,KAAK,KAAK,KAAA;CAEpD,IAAI,SAAQ,MADM,gBAAgB,WAAW,GAC7B,QAAQ,MAAM,EAAE,SAAS,WAAW;CACpD,IAAI,wBAAwB,KAAA,GAC1B,QAAQ,MAAM,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;EAKN,MAAM,IAAI,iBAAA,gBAER,aAAa,KAAK,+BALlB,MAAM,WAAW,IACb,wCACA,cAAc,QAAQ,QAI5B;CACF;CAEA,IAAI,iBAAiB,KAAA,GAAW;EAC9B,MAAM,aAAa,MAAM,QAAQ,MAAM,EAAE,iBAAiB,YAAY;EACtE,IAAI,WAAW,WAAW,GACxB,MAAM,IAAI,iBAAA,gBAER,aAAa,KAAK,+BAA+B,aAAa,gBAC7C,CAAC,GAAG,IAAI,IAAI,MAAM,KAAK,MAAM,EAAE,YAAY,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE,EAC7E;EAEF,IAAI,WAAW,SAAS,GAAG,MAAM,UAAU,MAAM,UAAU;EAC3D,OAAO,WAAW;CACpB;CAEA,IAAI,MAAM,SAAS,GAAG,MAAM,UAAU,MAAM,KAAK;CACjD,OAAO,MAAM;AACf"}
|
package/dist/types.d.ts
CHANGED
|
@@ -209,7 +209,8 @@ declare enum ManifestMCPErrorCode {
|
|
|
209
209
|
UNSUPPORTED_TX = "UNSUPPORTED_TX",
|
|
210
210
|
SIMULATION_FAILED = "SIMULATION_FAILED",
|
|
211
211
|
UNKNOWN_MODULE = "UNKNOWN_MODULE",
|
|
212
|
-
OPERATION_CANCELLED = "OPERATION_CANCELLED"
|
|
212
|
+
OPERATION_CANCELLED = "OPERATION_CANCELLED",
|
|
213
|
+
SKU_AMBIGUOUS = "SKU_AMBIGUOUS"
|
|
213
214
|
}
|
|
214
215
|
/**
|
|
215
216
|
* Custom error class for Manifest MCP errors
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiKA;;UAAiB,eAAA;EAEW;EAAA,SAAjB,iBAAiB;AAAA;;;;UAMX,WAAA;EAIN;EAAA,SAFA,UAAA;EAIU;EAAA,SAFV,WAAA;EAQM;EAAA,SANN,UAAA;AAAA;;;;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ACA,sBAAA,GACA,yBAAA,GACA,yBAAA,GACA,0BAAA,GACA,0BAAA,GACA,4BAAA,GACA,cAAA,GACA,eAAA,GACA,kBAAA,GACA,qBAAA,GACA,gBAAA,GACA,4BAAA,GACA,sBAAA,GACA,sBAAA,GACA,kBAAA,GACA,uBAAA,GACA,0BAAA,GACA,wBAAA,GACA,4BAAA,GACA,uBAAA,GACA,qBAAA,GACA,mBAAA,GACA,oBAAA,GACA,uBAAA;;;;UAKa,iBAAA;EAAA,SACN,MAAA;EAAA,SACA,UAAA;EAAA,SACA,MAAA,EAAQ,WAAW;AAAA"}
|
package/dist/types.js
CHANGED
|
@@ -16,6 +16,7 @@ let ManifestMCPErrorCode = /* @__PURE__ */ function(ManifestMCPErrorCode) {
|
|
|
16
16
|
ManifestMCPErrorCode["SIMULATION_FAILED"] = "SIMULATION_FAILED";
|
|
17
17
|
ManifestMCPErrorCode["UNKNOWN_MODULE"] = "UNKNOWN_MODULE";
|
|
18
18
|
ManifestMCPErrorCode["OPERATION_CANCELLED"] = "OPERATION_CANCELLED";
|
|
19
|
+
ManifestMCPErrorCode["SKU_AMBIGUOUS"] = "SKU_AMBIGUOUS";
|
|
19
20
|
return ManifestMCPErrorCode;
|
|
20
21
|
}({});
|
|
21
22
|
/**
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { EncodeObject, OfflineSigner } from '@cosmjs/proto-signing';\n// Auth module types\nimport type {\n Params as AuthParams,\n BaseAccount,\n ModuleAccount,\n} from '@manifest-network/manifestjs/dist/codegen/cosmos/auth/v1beta1/auth.js';\n// Authz module types\nimport type {\n Grant as AuthzGrant,\n GrantAuthorization as AuthzGrantAuthorization,\n} from '@manifest-network/manifestjs/dist/codegen/cosmos/authz/v1beta1/authz.js';\n// Bank module types\nimport type {\n Metadata as BankMetadata,\n Params as BankParams,\n SendEnabled,\n} from '@manifest-network/manifestjs/dist/codegen/cosmos/bank/v1beta1/bank.js';\n\n// Distribution module types\nimport type {\n DelegationDelegatorReward,\n Params as DistributionParams,\n ValidatorAccumulatedCommission,\n ValidatorOutstandingRewards,\n ValidatorSlashEvent,\n} from '@manifest-network/manifestjs/dist/codegen/cosmos/distribution/v1beta1/distribution.js';\n// Feegrant module types\nimport type { Grant as FeegrantGrant } from '@manifest-network/manifestjs/dist/codegen/cosmos/feegrant/v1beta1/feegrant.js';\n// Gov module types (v1 for newer chains)\nimport type {\n DepositParams,\n Deposit as GovDeposit,\n Params as GovParams,\n Proposal as GovProposal,\n TallyResult as GovTallyResult,\n Vote as GovVote,\n TallyParams,\n VotingParams,\n} from '@manifest-network/manifestjs/dist/codegen/cosmos/gov/v1/gov.js';\n// Group module types\nimport type {\n GroupInfo,\n GroupMember,\n GroupPolicyInfo,\n Proposal as GroupProposal,\n TallyResult as GroupTallyResult,\n Vote as GroupVote,\n} from '@manifest-network/manifestjs/dist/codegen/cosmos/group/v1/types.js';\n// Mint module types\nimport type { Params as MintParams } from '@manifest-network/manifestjs/dist/codegen/cosmos/mint/v1beta1/mint.js';\n// Staking module types\nimport type {\n DelegationResponse,\n HistoricalInfo,\n RedelegationResponse,\n Params as StakingParams,\n Pool as StakingPool,\n UnbondingDelegation,\n Validator,\n} from '@manifest-network/manifestjs/dist/codegen/cosmos/staking/v1beta1/staking.js';\nimport type { CodeInfoResponse } from '@manifest-network/manifestjs/dist/codegen/cosmwasm/wasm/v1/query.js';\n// CosmWasm module types\nimport type {\n ContractCodeHistoryEntry,\n ContractInfo,\n Model,\n Params as WasmParams,\n} from '@manifest-network/manifestjs/dist/codegen/cosmwasm/wasm/v1/types.js';\n// Protobuf Any type for polymorphic account types\nimport type { Any } from '@manifest-network/manifestjs/dist/codegen/google/protobuf/any.js';\n// IBC transfer types\nimport type {\n DenomTrace,\n Params as IbcTransferParams,\n} from '@manifest-network/manifestjs/dist/codegen/ibc/applications/transfer/v1/transfer.js';\n// Billing credit estimate response\nimport type { QueryCreditEstimateResponse } from '@manifest-network/manifestjs/dist/codegen/liftedinit/billing/v1/query.js';\nimport type { LeaseItemInput } from '@manifest-network/manifestjs/dist/codegen/liftedinit/billing/v1/tx.js';\n// Billing module types (Manifest-specific)\nimport type {\n Params as BillingParams,\n CreditAccount,\n Lease,\n} from '@manifest-network/manifestjs/dist/codegen/liftedinit/billing/v1/types.js';\n// SKU module types (Manifest-specific)\nimport type {\n Provider,\n SKU,\n Params as SkuParams,\n} from '@manifest-network/manifestjs/dist/codegen/liftedinit/sku/v1/types.js';\n// Tokenfactory types (Osmosis)\nimport type { DenomAuthorityMetadata } from '@manifest-network/manifestjs/dist/codegen/osmosis/tokenfactory/v1beta1/authorityMetadata.js';\nimport type { Params as TokenfactoryParams } from '@manifest-network/manifestjs/dist/codegen/osmosis/tokenfactory/v1beta1/params.js';\n// Proof-of-Authority (strangelove-ventures) types\nimport type { StakingParams as PoAStakingParams } from '@manifest-network/manifestjs/dist/codegen/strangelove_ventures/poa/v1/params.js';\nimport type { Validator as PoAValidator } from '@manifest-network/manifestjs/dist/codegen/strangelove_ventures/poa/v1/validator.js';\n\n// Re-export commonly used protobuf types for consumers\nexport type {\n Any,\n AuthParams,\n AuthzGrant,\n AuthzGrantAuthorization,\n BankMetadata,\n BankParams,\n BaseAccount,\n BillingParams,\n CodeInfoResponse,\n ContractCodeHistoryEntry,\n ContractInfo,\n CreditAccount,\n DelegationDelegatorReward,\n DelegationResponse,\n DenomAuthorityMetadata,\n DenomTrace,\n DepositParams,\n DistributionParams,\n FeegrantGrant,\n GovDeposit,\n GovParams,\n GovProposal,\n GovTallyResult,\n GovVote,\n GroupInfo,\n GroupMember,\n GroupPolicyInfo,\n GroupProposal,\n GroupTallyResult,\n GroupVote,\n HistoricalInfo,\n IbcTransferParams,\n Lease,\n LeaseItemInput,\n MintParams,\n Model,\n ModuleAccount,\n PoAStakingParams,\n PoAValidator,\n Provider,\n QueryCreditEstimateResponse,\n RedelegationResponse,\n SendEnabled,\n SKU,\n SkuParams,\n StakingParams,\n StakingPool,\n TallyParams,\n TokenfactoryParams,\n UnbondingDelegation,\n Validator,\n ValidatorAccumulatedCommission,\n ValidatorOutstandingRewards,\n ValidatorSlashEvent,\n VotingParams,\n WasmParams,\n};\n\n/**\n * Rate limiting configuration\n */\nexport interface RateLimitConfig {\n /** Maximum requests per second (default: 10) */\n readonly requestsPerSecond?: number;\n}\n\n/**\n * Retry configuration for transient RPC failures\n */\nexport interface RetryConfig {\n /** Maximum number of retry attempts (default: 3) */\n readonly maxRetries?: number;\n /** Base delay in milliseconds before first retry (default: 1000) */\n readonly baseDelayMs?: number;\n /** Maximum delay in milliseconds between retries (default: 10000) */\n readonly maxDelayMs?: number;\n}\n\n/**\n * Configuration for the Manifest MCP server\n */\nexport interface ManifestMCPConfig {\n /** Chain ID (e.g., \"manifest-ledger-testnet\") */\n readonly chainId: string;\n /** RPC endpoint URL (required for transactions; optional if restUrl provided for query-only mode) */\n readonly rpcUrl?: string;\n /** Gas price with denomination (e.g., \"1.0umfx\"); required when rpcUrl is provided */\n readonly gasPrice?: string;\n /** REST/LCD endpoint URL for queries (e.g., \"http://localhost:1317\") */\n readonly restUrl?: string;\n /** Address prefix (e.g., \"manifest\") */\n readonly addressPrefix?: string;\n /** Rate limiting configuration */\n readonly rateLimit?: RateLimitConfig;\n /** Retry configuration for transient failures */\n readonly retry?: RetryConfig;\n /** Gas simulation multiplier (default: 1.5, minimum: 1). A value of 1.0 uses the exact simulation result with no safety margin. Increase if transactions fail with out-of-gas errors. */\n readonly gasMultiplier?: number;\n}\n\n/**\n * Per-transaction overrides supplied by external callers (MCP tools, library consumers).\n */\nexport interface TxOverrides {\n readonly gasMultiplier?: number;\n}\n\n/**\n * Fully-resolved gas options passed to transaction handlers.\n * Constructed by `cosmosTx()` from caller-supplied `TxOverrides` and server config.\n */\nexport interface TxOptions {\n readonly gasMultiplier: number;\n readonly gasPrice: string;\n}\n\n/**\n * Optional read-only chain state passed to message builders/handlers so they\n * can preserve fields the caller did not explicitly override (e.g. governance\n * MsgUpdateParams that overwrites the full Params struct).\n *\n * Populated by `cosmosTx` / `cosmosEstimateFee` via the per-subcommand context\n * loader declared on the module's `TX_MODULES` registry entry. Subcommands\n * that don't declare a loader pay no extra round-trip and receive `undefined`.\n *\n * The shape is a bag of optional fields rather than a discriminated union so\n * adding a second loader (e.g. staking `update-params`) is additive — when\n * the third kind lands, consider switching to a discriminated union for\n * stricter cross-module isolation.\n */\nexport interface TxBuildContext {\n readonly currentBillingParams?: BillingParams;\n}\n\n/**\n * Wallet provider interface for different wallet implementations\n *\n * Any wallet that provides an OfflineSigner works (Keplr, Web3Auth, Leap, cosmos-kit, etc.)\n */\nexport interface SignArbitraryResult {\n readonly pub_key: { readonly type: string; readonly value: string };\n readonly signature: string;\n}\n\nexport interface WalletProvider {\n /** Get the wallet's address */\n getAddress(): Promise<string>;\n /** Get the offline signer for signing transactions */\n getSigner(): Promise<OfflineSigner>;\n /** Optional: Sign arbitrary data (ADR-036) for off-chain authentication */\n signArbitrary?(address: string, data: string): Promise<SignArbitraryResult>;\n /** Optional: Connect to the wallet */\n connect?(): Promise<void>;\n /** Optional: Disconnect from the wallet */\n disconnect?(): Promise<void>;\n}\n\n/**\n * Messages built by a transaction module's message builder, ready for\n * simulation or signing/broadcasting.\n */\nexport interface BuiltMessages {\n readonly messages: readonly EncodeObject[];\n /**\n * Memo string (default ''). Required (not optional) for type cleanliness:\n * call sites get a guaranteed string and don't need `?? ''` coalescing.\n * (At the protobuf encoding layer, '' and undefined are byte-equivalent,\n * so this is purely a type-design choice, not a behavior fix.)\n */\n readonly memo: string;\n /**\n * Canonical subcommand name when the input was an alias.\n * E.g., staking accepts both 'unbond' and 'undelegate' and reports 'unbond' for both.\n * When omitted, callers should use the original subcommand they passed in.\n */\n readonly canonicalSubcommand?: string;\n}\n\n/**\n * Result from a fee estimation (simulation without broadcast)\n */\nexport interface FeeEstimateResult {\n readonly module: string;\n /** Canonical subcommand name (e.g., 'undelegate' is normalized to 'unbond'). */\n readonly subcommand: string;\n /**\n * Raw gas estimate from simulation, stringified for serialization consistency\n * with `CosmosTxResult.gasUsed` / `gasWanted`.\n */\n readonly gasEstimate: string;\n readonly fee: {\n readonly amount: readonly {\n readonly denom: string;\n readonly amount: string;\n }[];\n /** Gas limit, equal to ceil(gasEstimate * gasMultiplier). */\n readonly gas: string;\n };\n}\n\n/**\n * Result from a Cosmos transaction\n */\nexport interface CosmosTxResult {\n readonly module: string;\n readonly subcommand: string;\n readonly transactionHash: string;\n readonly code: number;\n readonly height: string;\n readonly rawLog?: string;\n readonly confirmed?: boolean;\n readonly confirmationHeight?: string;\n readonly gasUsed?: string;\n readonly gasWanted?: string;\n readonly events?: readonly {\n readonly type: string;\n readonly attributes: readonly {\n readonly key: string;\n readonly value: string;\n }[];\n }[];\n}\n\n/**\n * Module information for discovery\n */\nexport interface ModuleInfo {\n readonly name: string;\n readonly description: string;\n readonly args?: string; // Usage hint for arguments\n}\n\n/**\n * Available modules listing\n */\nexport interface AvailableModules {\n readonly queryModules: readonly ModuleInfo[];\n readonly txModules: readonly ModuleInfo[];\n}\n\n/**\n * Error codes for ManifestMCPError\n */\nexport enum ManifestMCPErrorCode {\n // Configuration errors\n INVALID_CONFIG = 'INVALID_CONFIG',\n\n // Wallet errors\n WALLET_NOT_CONNECTED = 'WALLET_NOT_CONNECTED',\n WALLET_CONNECTION_FAILED = 'WALLET_CONNECTION_FAILED',\n INVALID_MNEMONIC = 'INVALID_MNEMONIC',\n\n // Client errors\n RPC_CONNECTION_FAILED = 'RPC_CONNECTION_FAILED',\n\n // Query errors\n QUERY_FAILED = 'QUERY_FAILED',\n UNSUPPORTED_QUERY = 'UNSUPPORTED_QUERY',\n INVALID_ADDRESS = 'INVALID_ADDRESS',\n\n // Transaction errors\n TX_FAILED = 'TX_FAILED',\n UNSUPPORTED_TX = 'UNSUPPORTED_TX',\n SIMULATION_FAILED = 'SIMULATION_FAILED',\n\n // Module errors\n UNKNOWN_MODULE = 'UNKNOWN_MODULE',\n\n // User-action errors\n // A deliberate user decline / cancel / elicitation-timeout. Per the MCP\n // elicitation spec these are expected \"cancellation\" outcomes, not faults —\n // so this code is treated as NEITHER infrastructure (server-utils.ts'\n // INFRASTRUCTURE_ERROR_CODES) NOR retryable (retry.ts'\n // NON_RETRYABLE_ERROR_CODES lists it). Retrying a user's cancel makes no\n // sense; surfacing it as UNKNOWN (the prior bug, ENG-272) hid the cause.\n OPERATION_CANCELLED = 'OPERATION_CANCELLED',\n}\n\n/**\n * Custom error class for Manifest MCP errors\n */\nexport class ManifestMCPError extends Error {\n public readonly code: ManifestMCPErrorCode;\n public readonly details?: Record<string, unknown>;\n\n constructor(\n code: ManifestMCPErrorCode,\n message: string,\n details?: Record<string, unknown>,\n ) {\n super(message);\n this.name = 'ManifestMCPError';\n this.code = code;\n this.details = details;\n\n // Ensure proper prototype chain for instanceof checks\n Object.setPrototypeOf(this, ManifestMCPError.prototype);\n }\n\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n code: this.code,\n message: this.message,\n details: this.details,\n };\n }\n}\n\n/**\n * Account information\n */\nexport interface AccountInfo {\n readonly address: string;\n}\n\n// ============================================================================\n// Query Result Types\n// ============================================================================\n\n/**\n * Pagination response from Cosmos SDK queries\n */\nexport interface PaginationResponse {\n readonly nextKey?: Uint8Array;\n readonly total?: bigint;\n}\n\n/**\n * Base interface for paginated query results\n */\nexport interface PaginatedResult {\n readonly pagination?: PaginationResponse;\n}\n\n/**\n * Coin type from Cosmos SDK\n */\nexport interface Coin {\n readonly denom: string;\n readonly amount: string;\n}\n\n/**\n * DecCoin type from Cosmos SDK (for rewards, commission, etc.)\n *\n * DecCoin has the same structure as Coin but represents decimal amounts\n * used in distribution calculations. The amount string may contain decimals.\n */\nexport type DecCoin = Coin;\n\n// Bank query results\nexport interface BalanceResult {\n readonly balance?: Coin;\n}\n\nexport interface BalancesResult extends PaginatedResult {\n readonly balances: readonly Coin[];\n}\n\nexport interface TotalSupplyResult extends PaginatedResult {\n readonly supply: readonly Coin[];\n}\n\nexport interface SupplyOfResult {\n readonly amount?: Coin;\n}\n\nexport interface DenomMetadataResult {\n readonly metadata?: BankMetadata;\n}\n\nexport interface DenomsMetadataResult extends PaginatedResult {\n readonly metadatas: readonly BankMetadata[];\n}\n\nexport interface SendEnabledResult extends PaginatedResult {\n readonly sendEnabled: readonly SendEnabled[];\n}\n\nexport interface BankParamsResult {\n readonly params?: BankParams;\n}\n\n// Staking query results\nexport interface DelegationResult {\n readonly delegationResponse?: DelegationResponse;\n}\n\nexport interface DelegationsResult extends PaginatedResult {\n readonly delegationResponses: readonly DelegationResponse[];\n}\n\nexport interface UnbondingDelegationResult {\n readonly unbond?: UnbondingDelegation;\n}\n\nexport interface UnbondingDelegationsResult extends PaginatedResult {\n readonly unbondingResponses: readonly UnbondingDelegation[];\n}\n\nexport interface RedelegationsResult extends PaginatedResult {\n readonly redelegationResponses: readonly RedelegationResponse[];\n}\n\nexport interface ValidatorResult {\n readonly validator?: Validator;\n}\n\nexport interface ValidatorsResult extends PaginatedResult {\n readonly validators: readonly Validator[];\n}\n\nexport interface StakingPoolResult {\n readonly pool?: StakingPool;\n}\n\nexport interface StakingParamsResult {\n readonly params?: StakingParams;\n}\n\nexport interface HistoricalInfoResult {\n readonly hist?: HistoricalInfo;\n}\n\n// Distribution query results\n// Note: When querying all rewards, 'rewards' is DelegationDelegatorReward[] (per validator).\n// When querying specific validator, 'rewards' is DecCoin[] (direct reward coins).\nexport interface RewardsResult {\n readonly rewards: readonly DecCoin[] | readonly DelegationDelegatorReward[];\n readonly total?: readonly DecCoin[];\n}\n\nexport interface CommissionResult {\n readonly commission?: ValidatorAccumulatedCommission;\n}\n\nexport interface CommunityPoolResult {\n readonly pool: readonly DecCoin[];\n}\n\nexport interface DistributionParamsResult {\n readonly params?: DistributionParams;\n}\n\nexport interface ValidatorOutstandingRewardsResult {\n readonly rewards?: ValidatorOutstandingRewards;\n}\n\nexport interface SlashesResult extends PaginatedResult {\n readonly slashes: readonly ValidatorSlashEvent[];\n}\n\nexport interface DelegatorValidatorsResult {\n readonly validators: readonly string[];\n}\n\nexport interface DelegatorWithdrawAddressResult {\n readonly withdrawAddress: string;\n}\n\n// Gov query results\nexport interface ProposalResult {\n readonly proposal?: GovProposal;\n}\n\nexport interface ProposalsResult extends PaginatedResult {\n readonly proposals: readonly GovProposal[];\n}\n\nexport interface VoteResult {\n readonly vote?: GovVote;\n}\n\nexport interface VotesResult extends PaginatedResult {\n readonly votes: readonly GovVote[];\n}\n\nexport interface DepositResult {\n readonly deposit?: GovDeposit;\n}\n\nexport interface DepositsResult extends PaginatedResult {\n readonly deposits: readonly GovDeposit[];\n}\n\nexport interface TallyResult {\n readonly tally?: GovTallyResult;\n}\n\nexport interface GovParamsResult {\n readonly votingParams?: VotingParams;\n readonly depositParams?: DepositParams;\n readonly tallyParams?: TallyParams;\n readonly params?: GovParams;\n}\n\n// Auth query results\n// Note: Account types are polymorphic - the RPC can return BaseAccount, ModuleAccount, or other account types wrapped in Any\nexport interface AuthAccountResult {\n readonly account?: BaseAccount | ModuleAccount | Any;\n}\n\nexport interface AuthAccountsResult extends PaginatedResult {\n readonly accounts: readonly (BaseAccount | Any)[];\n}\n\nexport interface AuthParamsResult {\n readonly params?: AuthParams;\n}\n\nexport interface ModuleAccountsResult {\n readonly accounts: readonly (ModuleAccount | Any)[];\n}\n\nexport interface AddressBytesToStringResult {\n readonly addressString: string;\n}\n\nexport interface AddressStringToBytesResult {\n readonly addressBytes: string;\n}\n\nexport interface Bech32PrefixResult {\n readonly bech32Prefix: string;\n}\n\nexport interface AccountInfoResult {\n readonly info?: BaseAccount;\n}\n\n// Billing query results\nexport interface BillingParamsResult {\n readonly params?: BillingParams;\n}\n\nexport interface LeaseResult {\n readonly lease?: Lease;\n}\n\nexport interface LeasesResult extends PaginatedResult {\n readonly leases: readonly Lease[];\n}\n\nexport interface CreditAccountResult {\n readonly creditAccount?: CreditAccount;\n readonly balances: readonly Coin[];\n readonly availableBalances: readonly Coin[];\n}\n\nexport interface CreditAccountsResult extends PaginatedResult {\n readonly creditAccounts: readonly CreditAccount[];\n}\n\nexport interface CreditAddressResult {\n readonly creditAddress: string;\n}\n\nexport interface WithdrawableAmountResult {\n readonly amounts: readonly Coin[];\n}\n\nexport interface ProviderWithdrawableResult {\n readonly amounts: readonly Coin[];\n readonly leaseCount: bigint;\n readonly hasMore: boolean;\n}\n\nexport interface CreditEstimateResult {\n readonly estimate: QueryCreditEstimateResponse;\n}\n\nexport interface LeaseByCustomDomainResult {\n readonly lease: Lease;\n readonly serviceName: string;\n}\n\n// Group query results\nexport interface GroupInfoResult {\n readonly info?: GroupInfo;\n}\n\nexport interface GroupPolicyInfoResult {\n readonly info?: GroupPolicyInfo;\n}\n\nexport interface GroupMembersResult extends PaginatedResult {\n readonly members: readonly GroupMember[];\n}\n\nexport interface GroupsResult extends PaginatedResult {\n readonly groups: readonly GroupInfo[];\n}\n\nexport interface GroupPoliciesResult extends PaginatedResult {\n readonly groupPolicies: readonly GroupPolicyInfo[];\n}\n\nexport interface GroupProposalResult {\n readonly proposal?: GroupProposal;\n}\n\nexport interface GroupProposalsResult extends PaginatedResult {\n readonly proposals: readonly GroupProposal[];\n}\n\nexport interface GroupVoteResult {\n readonly vote?: GroupVote;\n}\n\nexport interface GroupVotesResult extends PaginatedResult {\n readonly votes: readonly GroupVote[];\n}\n\nexport interface GroupTallyQueryResult {\n readonly tally?: GroupTallyResult;\n}\n\n// SKU query results\nexport interface SkuParamsResult {\n readonly params?: SkuParams;\n}\n\nexport interface ProviderResult {\n readonly provider?: Provider;\n}\n\nexport interface ProvidersResult extends PaginatedResult {\n readonly providers: readonly Provider[];\n}\n\nexport interface SkuResult {\n readonly sku?: SKU;\n}\n\nexport interface SkusResult extends PaginatedResult {\n readonly skus: readonly SKU[];\n}\n\n// CosmWasm query results\nexport interface WasmContractInfoResult {\n readonly address: string;\n readonly contractInfo?: ContractInfo;\n}\n\nexport interface WasmContractHistoryResult extends PaginatedResult {\n readonly entries: readonly ContractCodeHistoryEntry[];\n}\n\nexport interface WasmContractsByCodeResult extends PaginatedResult {\n readonly contracts: readonly string[];\n}\n\nexport interface WasmAllContractStateResult extends PaginatedResult {\n readonly models: readonly Model[];\n}\n\nexport interface WasmRawContractStateResult {\n readonly data: string; // base64-encoded\n}\n\nexport interface WasmSmartContractStateResult {\n readonly data: unknown;\n}\n\n/** JSON-safe representation of CodeInfoResponse with dataHash encoded as base64. */\nexport interface WasmCodeInfo {\n readonly codeId: bigint;\n readonly creator: string;\n readonly dataHash: string; // base64-encoded\n readonly instantiatePermission: {\n readonly permission: number;\n readonly addresses: readonly string[];\n };\n}\n\nexport interface WasmCodeResult {\n readonly codeInfo?: WasmCodeInfo;\n readonly data: string; // base64-encoded wasm bytecode\n}\n\nexport interface WasmCodesResult extends PaginatedResult {\n readonly codeInfos: readonly WasmCodeInfo[];\n}\n\nexport interface WasmCodeInfoResult {\n readonly codeInfo?: WasmCodeInfo;\n}\n\nexport interface WasmPinnedCodesResult extends PaginatedResult {\n readonly codeIds: readonly bigint[];\n}\n\nexport interface WasmParamsResult {\n readonly params?: WasmParams;\n}\n\nexport interface WasmContractsByCreatorResult extends PaginatedResult {\n readonly contractAddresses: readonly string[];\n}\n\nexport interface WasmLimitsConfigResult {\n readonly config: string;\n}\n\nexport interface WasmBuildAddressResult {\n readonly address: string;\n}\n\n// Proof-of-Authority (strangelove_ventures) query results\nexport interface PoAAuthorityResult {\n readonly authority: string;\n}\n\nexport interface PoAConsensusPowerResult {\n readonly consensusPower: bigint;\n}\n\nexport interface PoAPendingValidatorsResult {\n readonly pending: readonly PoAValidator[];\n}\n\n// Tokenfactory (osmosis) query results\nexport interface TokenfactoryParamsResult {\n readonly params?: TokenfactoryParams;\n}\n\nexport interface DenomAuthorityMetadataResult {\n readonly authorityMetadata?: DenomAuthorityMetadata;\n}\n\nexport interface DenomsFromCreatorResult {\n readonly denoms: readonly string[];\n}\n\nexport interface DenomsFromAdminResult {\n readonly denoms: readonly string[];\n}\n\n// Authz query results\nexport interface AuthzGrantsResult extends PaginatedResult {\n readonly grants: readonly AuthzGrant[];\n}\n\nexport interface AuthzGranterGrantsResult extends PaginatedResult {\n readonly grants: readonly AuthzGrantAuthorization[];\n}\n\nexport interface AuthzGranteeGrantsResult extends PaginatedResult {\n readonly grants: readonly AuthzGrantAuthorization[];\n}\n\n// Feegrant query results\nexport interface FeegrantAllowanceResult {\n readonly allowance?: FeegrantGrant;\n}\n\nexport interface FeegrantAllowancesResult extends PaginatedResult {\n readonly allowances: readonly FeegrantGrant[];\n}\n\n// Mint query results\nexport interface MintParamsResult {\n readonly params?: MintParams;\n}\n\nexport interface MintInflationResult {\n readonly inflation: string;\n}\n\nexport interface MintAnnualProvisionsResult {\n readonly annualProvisions: string;\n}\n\n// IBC transfer query results\nexport interface IbcDenomTraceResult {\n readonly denomTrace?: DenomTrace;\n}\n\nexport interface IbcDenomTracesResult extends PaginatedResult {\n readonly denomTraces: readonly DenomTrace[];\n}\n\nexport interface IbcTransferParamsResult {\n readonly params?: IbcTransferParams;\n}\n\n/**\n * Union type of all query results for type-safe handling\n */\nexport type QueryResult =\n | BalanceResult\n | BalancesResult\n | TotalSupplyResult\n | SupplyOfResult\n | DenomMetadataResult\n | DenomsMetadataResult\n | SendEnabledResult\n | BankParamsResult\n | DelegationResult\n | DelegationsResult\n | UnbondingDelegationResult\n | UnbondingDelegationsResult\n | RedelegationsResult\n | ValidatorResult\n | ValidatorsResult\n | StakingPoolResult\n | StakingParamsResult\n | HistoricalInfoResult\n | RewardsResult\n | CommissionResult\n | CommunityPoolResult\n | DistributionParamsResult\n | ValidatorOutstandingRewardsResult\n | SlashesResult\n | DelegatorValidatorsResult\n | DelegatorWithdrawAddressResult\n | ProposalResult\n | ProposalsResult\n | VoteResult\n | VotesResult\n | DepositResult\n | DepositsResult\n | TallyResult\n | GovParamsResult\n | AuthAccountResult\n | AuthAccountsResult\n | AuthParamsResult\n | ModuleAccountsResult\n | AddressBytesToStringResult\n | AddressStringToBytesResult\n | Bech32PrefixResult\n | AccountInfoResult\n | AuthzGrantsResult\n | AuthzGranterGrantsResult\n | AuthzGranteeGrantsResult\n | FeegrantAllowanceResult\n | FeegrantAllowancesResult\n | MintParamsResult\n | MintInflationResult\n | MintAnnualProvisionsResult\n | BillingParamsResult\n | LeaseResult\n | LeasesResult\n | CreditAccountResult\n | CreditAccountsResult\n | CreditAddressResult\n | WithdrawableAmountResult\n | ProviderWithdrawableResult\n | CreditEstimateResult\n | LeaseByCustomDomainResult\n | SkuParamsResult\n | ProviderResult\n | ProvidersResult\n | SkuResult\n | SkusResult\n | GroupInfoResult\n | GroupPolicyInfoResult\n | GroupMembersResult\n | GroupsResult\n | GroupPoliciesResult\n | GroupProposalResult\n | GroupProposalsResult\n | GroupVoteResult\n | GroupVotesResult\n | GroupTallyQueryResult\n | WasmContractInfoResult\n | WasmContractHistoryResult\n | WasmContractsByCodeResult\n | WasmAllContractStateResult\n | WasmRawContractStateResult\n | WasmSmartContractStateResult\n | WasmCodeResult\n | WasmCodesResult\n | WasmCodeInfoResult\n | WasmPinnedCodesResult\n | WasmParamsResult\n | WasmContractsByCreatorResult\n | WasmLimitsConfigResult\n | WasmBuildAddressResult\n | PoAAuthorityResult\n | PoAConsensusPowerResult\n | PoAPendingValidatorsResult\n | TokenfactoryParamsResult\n | DenomAuthorityMetadataResult\n | DenomsFromCreatorResult\n | DenomsFromAdminResult\n | IbcDenomTraceResult\n | IbcDenomTracesResult\n | IbcTransferParamsResult;\n\n/**\n * Result from a Cosmos query\n */\nexport interface CosmosQueryResult {\n readonly module: string;\n readonly subcommand: string;\n readonly result: QueryResult;\n}\n"],"mappings":";;;;AAuVA,IAAY,uBAAL,yBAAA,sBAAA;CAEL,qBAAA,oBAAA;CAGA,qBAAA,0BAAA;CACA,qBAAA,8BAAA;CACA,qBAAA,sBAAA;CAGA,qBAAA,2BAAA;CAGA,qBAAA,kBAAA;CACA,qBAAA,uBAAA;CACA,qBAAA,qBAAA;CAGA,qBAAA,eAAA;CACA,qBAAA,oBAAA;CACA,qBAAA,uBAAA;CAGA,qBAAA,oBAAA;CASA,qBAAA,yBAAA;;AACF,EAAA,CAAA,CAAA;;;;AAKA,IAAa,mBAAb,MAAa,yBAAyB,MAAM;CAI1C,YACE,MACA,SACA,SACA;EACA,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,UAAU;EAGf,OAAO,eAAe,MAAM,iBAAiB,SAAS;CACxD;CAEA,SAAkC;EAChC,OAAO;GACL,MAAM,KAAK;GACX,MAAM,KAAK;GACX,SAAS,KAAK;GACd,SAAS,KAAK;EAChB;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { EncodeObject, OfflineSigner } from '@cosmjs/proto-signing';\n// Auth module types\nimport type {\n Params as AuthParams,\n BaseAccount,\n ModuleAccount,\n} from '@manifest-network/manifestjs/dist/codegen/cosmos/auth/v1beta1/auth.js';\n// Authz module types\nimport type {\n Grant as AuthzGrant,\n GrantAuthorization as AuthzGrantAuthorization,\n} from '@manifest-network/manifestjs/dist/codegen/cosmos/authz/v1beta1/authz.js';\n// Bank module types\nimport type {\n Metadata as BankMetadata,\n Params as BankParams,\n SendEnabled,\n} from '@manifest-network/manifestjs/dist/codegen/cosmos/bank/v1beta1/bank.js';\n\n// Distribution module types\nimport type {\n DelegationDelegatorReward,\n Params as DistributionParams,\n ValidatorAccumulatedCommission,\n ValidatorOutstandingRewards,\n ValidatorSlashEvent,\n} from '@manifest-network/manifestjs/dist/codegen/cosmos/distribution/v1beta1/distribution.js';\n// Feegrant module types\nimport type { Grant as FeegrantGrant } from '@manifest-network/manifestjs/dist/codegen/cosmos/feegrant/v1beta1/feegrant.js';\n// Gov module types (v1 for newer chains)\nimport type {\n DepositParams,\n Deposit as GovDeposit,\n Params as GovParams,\n Proposal as GovProposal,\n TallyResult as GovTallyResult,\n Vote as GovVote,\n TallyParams,\n VotingParams,\n} from '@manifest-network/manifestjs/dist/codegen/cosmos/gov/v1/gov.js';\n// Group module types\nimport type {\n GroupInfo,\n GroupMember,\n GroupPolicyInfo,\n Proposal as GroupProposal,\n TallyResult as GroupTallyResult,\n Vote as GroupVote,\n} from '@manifest-network/manifestjs/dist/codegen/cosmos/group/v1/types.js';\n// Mint module types\nimport type { Params as MintParams } from '@manifest-network/manifestjs/dist/codegen/cosmos/mint/v1beta1/mint.js';\n// Staking module types\nimport type {\n DelegationResponse,\n HistoricalInfo,\n RedelegationResponse,\n Params as StakingParams,\n Pool as StakingPool,\n UnbondingDelegation,\n Validator,\n} from '@manifest-network/manifestjs/dist/codegen/cosmos/staking/v1beta1/staking.js';\nimport type { CodeInfoResponse } from '@manifest-network/manifestjs/dist/codegen/cosmwasm/wasm/v1/query.js';\n// CosmWasm module types\nimport type {\n ContractCodeHistoryEntry,\n ContractInfo,\n Model,\n Params as WasmParams,\n} from '@manifest-network/manifestjs/dist/codegen/cosmwasm/wasm/v1/types.js';\n// Protobuf Any type for polymorphic account types\nimport type { Any } from '@manifest-network/manifestjs/dist/codegen/google/protobuf/any.js';\n// IBC transfer types\nimport type {\n DenomTrace,\n Params as IbcTransferParams,\n} from '@manifest-network/manifestjs/dist/codegen/ibc/applications/transfer/v1/transfer.js';\n// Billing credit estimate response\nimport type { QueryCreditEstimateResponse } from '@manifest-network/manifestjs/dist/codegen/liftedinit/billing/v1/query.js';\nimport type { LeaseItemInput } from '@manifest-network/manifestjs/dist/codegen/liftedinit/billing/v1/tx.js';\n// Billing module types (Manifest-specific)\nimport type {\n Params as BillingParams,\n CreditAccount,\n Lease,\n} from '@manifest-network/manifestjs/dist/codegen/liftedinit/billing/v1/types.js';\n// SKU module types (Manifest-specific)\nimport type {\n Provider,\n SKU,\n Params as SkuParams,\n} from '@manifest-network/manifestjs/dist/codegen/liftedinit/sku/v1/types.js';\n// Tokenfactory types (Osmosis)\nimport type { DenomAuthorityMetadata } from '@manifest-network/manifestjs/dist/codegen/osmosis/tokenfactory/v1beta1/authorityMetadata.js';\nimport type { Params as TokenfactoryParams } from '@manifest-network/manifestjs/dist/codegen/osmosis/tokenfactory/v1beta1/params.js';\n// Proof-of-Authority (strangelove-ventures) types\nimport type { StakingParams as PoAStakingParams } from '@manifest-network/manifestjs/dist/codegen/strangelove_ventures/poa/v1/params.js';\nimport type { Validator as PoAValidator } from '@manifest-network/manifestjs/dist/codegen/strangelove_ventures/poa/v1/validator.js';\n\n// Re-export commonly used protobuf types for consumers\nexport type {\n Any,\n AuthParams,\n AuthzGrant,\n AuthzGrantAuthorization,\n BankMetadata,\n BankParams,\n BaseAccount,\n BillingParams,\n CodeInfoResponse,\n ContractCodeHistoryEntry,\n ContractInfo,\n CreditAccount,\n DelegationDelegatorReward,\n DelegationResponse,\n DenomAuthorityMetadata,\n DenomTrace,\n DepositParams,\n DistributionParams,\n FeegrantGrant,\n GovDeposit,\n GovParams,\n GovProposal,\n GovTallyResult,\n GovVote,\n GroupInfo,\n GroupMember,\n GroupPolicyInfo,\n GroupProposal,\n GroupTallyResult,\n GroupVote,\n HistoricalInfo,\n IbcTransferParams,\n Lease,\n LeaseItemInput,\n MintParams,\n Model,\n ModuleAccount,\n PoAStakingParams,\n PoAValidator,\n Provider,\n QueryCreditEstimateResponse,\n RedelegationResponse,\n SendEnabled,\n SKU,\n SkuParams,\n StakingParams,\n StakingPool,\n TallyParams,\n TokenfactoryParams,\n UnbondingDelegation,\n Validator,\n ValidatorAccumulatedCommission,\n ValidatorOutstandingRewards,\n ValidatorSlashEvent,\n VotingParams,\n WasmParams,\n};\n\n/**\n * Rate limiting configuration\n */\nexport interface RateLimitConfig {\n /** Maximum requests per second (default: 10) */\n readonly requestsPerSecond?: number;\n}\n\n/**\n * Retry configuration for transient RPC failures\n */\nexport interface RetryConfig {\n /** Maximum number of retry attempts (default: 3) */\n readonly maxRetries?: number;\n /** Base delay in milliseconds before first retry (default: 1000) */\n readonly baseDelayMs?: number;\n /** Maximum delay in milliseconds between retries (default: 10000) */\n readonly maxDelayMs?: number;\n}\n\n/**\n * Configuration for the Manifest MCP server\n */\nexport interface ManifestMCPConfig {\n /** Chain ID (e.g., \"manifest-ledger-testnet\") */\n readonly chainId: string;\n /** RPC endpoint URL (required for transactions; optional if restUrl provided for query-only mode) */\n readonly rpcUrl?: string;\n /** Gas price with denomination (e.g., \"1.0umfx\"); required when rpcUrl is provided */\n readonly gasPrice?: string;\n /** REST/LCD endpoint URL for queries (e.g., \"http://localhost:1317\") */\n readonly restUrl?: string;\n /** Address prefix (e.g., \"manifest\") */\n readonly addressPrefix?: string;\n /** Rate limiting configuration */\n readonly rateLimit?: RateLimitConfig;\n /** Retry configuration for transient failures */\n readonly retry?: RetryConfig;\n /** Gas simulation multiplier (default: 1.5, minimum: 1). A value of 1.0 uses the exact simulation result with no safety margin. Increase if transactions fail with out-of-gas errors. */\n readonly gasMultiplier?: number;\n}\n\n/**\n * Per-transaction overrides supplied by external callers (MCP tools, library consumers).\n */\nexport interface TxOverrides {\n readonly gasMultiplier?: number;\n}\n\n/**\n * Fully-resolved gas options passed to transaction handlers.\n * Constructed by `cosmosTx()` from caller-supplied `TxOverrides` and server config.\n */\nexport interface TxOptions {\n readonly gasMultiplier: number;\n readonly gasPrice: string;\n}\n\n/**\n * Optional read-only chain state passed to message builders/handlers so they\n * can preserve fields the caller did not explicitly override (e.g. governance\n * MsgUpdateParams that overwrites the full Params struct).\n *\n * Populated by `cosmosTx` / `cosmosEstimateFee` via the per-subcommand context\n * loader declared on the module's `TX_MODULES` registry entry. Subcommands\n * that don't declare a loader pay no extra round-trip and receive `undefined`.\n *\n * The shape is a bag of optional fields rather than a discriminated union so\n * adding a second loader (e.g. staking `update-params`) is additive — when\n * the third kind lands, consider switching to a discriminated union for\n * stricter cross-module isolation.\n */\nexport interface TxBuildContext {\n readonly currentBillingParams?: BillingParams;\n}\n\n/**\n * Wallet provider interface for different wallet implementations\n *\n * Any wallet that provides an OfflineSigner works (Keplr, Web3Auth, Leap, cosmos-kit, etc.)\n */\nexport interface SignArbitraryResult {\n readonly pub_key: { readonly type: string; readonly value: string };\n readonly signature: string;\n}\n\nexport interface WalletProvider {\n /** Get the wallet's address */\n getAddress(): Promise<string>;\n /** Get the offline signer for signing transactions */\n getSigner(): Promise<OfflineSigner>;\n /** Optional: Sign arbitrary data (ADR-036) for off-chain authentication */\n signArbitrary?(address: string, data: string): Promise<SignArbitraryResult>;\n /** Optional: Connect to the wallet */\n connect?(): Promise<void>;\n /** Optional: Disconnect from the wallet */\n disconnect?(): Promise<void>;\n}\n\n/**\n * Messages built by a transaction module's message builder, ready for\n * simulation or signing/broadcasting.\n */\nexport interface BuiltMessages {\n readonly messages: readonly EncodeObject[];\n /**\n * Memo string (default ''). Required (not optional) for type cleanliness:\n * call sites get a guaranteed string and don't need `?? ''` coalescing.\n * (At the protobuf encoding layer, '' and undefined are byte-equivalent,\n * so this is purely a type-design choice, not a behavior fix.)\n */\n readonly memo: string;\n /**\n * Canonical subcommand name when the input was an alias.\n * E.g., staking accepts both 'unbond' and 'undelegate' and reports 'unbond' for both.\n * When omitted, callers should use the original subcommand they passed in.\n */\n readonly canonicalSubcommand?: string;\n}\n\n/**\n * Result from a fee estimation (simulation without broadcast)\n */\nexport interface FeeEstimateResult {\n readonly module: string;\n /** Canonical subcommand name (e.g., 'undelegate' is normalized to 'unbond'). */\n readonly subcommand: string;\n /**\n * Raw gas estimate from simulation, stringified for serialization consistency\n * with `CosmosTxResult.gasUsed` / `gasWanted`.\n */\n readonly gasEstimate: string;\n readonly fee: {\n readonly amount: readonly {\n readonly denom: string;\n readonly amount: string;\n }[];\n /** Gas limit, equal to ceil(gasEstimate * gasMultiplier). */\n readonly gas: string;\n };\n}\n\n/**\n * Result from a Cosmos transaction\n */\nexport interface CosmosTxResult {\n readonly module: string;\n readonly subcommand: string;\n readonly transactionHash: string;\n readonly code: number;\n readonly height: string;\n readonly rawLog?: string;\n readonly confirmed?: boolean;\n readonly confirmationHeight?: string;\n readonly gasUsed?: string;\n readonly gasWanted?: string;\n readonly events?: readonly {\n readonly type: string;\n readonly attributes: readonly {\n readonly key: string;\n readonly value: string;\n }[];\n }[];\n}\n\n/**\n * Module information for discovery\n */\nexport interface ModuleInfo {\n readonly name: string;\n readonly description: string;\n readonly args?: string; // Usage hint for arguments\n}\n\n/**\n * Available modules listing\n */\nexport interface AvailableModules {\n readonly queryModules: readonly ModuleInfo[];\n readonly txModules: readonly ModuleInfo[];\n}\n\n/**\n * Error codes for ManifestMCPError\n */\nexport enum ManifestMCPErrorCode {\n // Configuration errors\n INVALID_CONFIG = 'INVALID_CONFIG',\n\n // Wallet errors\n WALLET_NOT_CONNECTED = 'WALLET_NOT_CONNECTED',\n WALLET_CONNECTION_FAILED = 'WALLET_CONNECTION_FAILED',\n INVALID_MNEMONIC = 'INVALID_MNEMONIC',\n\n // Client errors\n RPC_CONNECTION_FAILED = 'RPC_CONNECTION_FAILED',\n\n // Query errors\n QUERY_FAILED = 'QUERY_FAILED',\n UNSUPPORTED_QUERY = 'UNSUPPORTED_QUERY',\n INVALID_ADDRESS = 'INVALID_ADDRESS',\n\n // Transaction errors\n TX_FAILED = 'TX_FAILED',\n UNSUPPORTED_TX = 'UNSUPPORTED_TX',\n SIMULATION_FAILED = 'SIMULATION_FAILED',\n\n // Module errors\n UNKNOWN_MODULE = 'UNKNOWN_MODULE',\n\n // User-action errors\n // A deliberate user decline / cancel / elicitation-timeout. Per the MCP\n // elicitation spec these are expected \"cancellation\" outcomes, not faults —\n // so this code is treated as NEITHER infrastructure (server-utils.ts'\n // INFRASTRUCTURE_ERROR_CODES) NOR retryable (retry.ts'\n // NON_RETRYABLE_ERROR_CODES lists it). Retrying a user's cancel makes no\n // sense; surfacing it as UNKNOWN (the prior bug, ENG-272) hid the cause.\n OPERATION_CANCELLED = 'OPERATION_CANCELLED',\n\n // SKU-resolution errors\n // A user-supplied SKU `size`/`storage` name matched more than one active\n // SKU and no disambiguator (provider_uuid / sku_uuid) was given. The error\n // carries `details = { reason: 'AMBIGUOUS_SKU_NAME', size, candidates }`.\n // Non-retryable: retrying without a disambiguator is pointless (ENG-258).\n SKU_AMBIGUOUS = 'SKU_AMBIGUOUS',\n}\n\n/**\n * Custom error class for Manifest MCP errors\n */\nexport class ManifestMCPError extends Error {\n public readonly code: ManifestMCPErrorCode;\n public readonly details?: Record<string, unknown>;\n\n constructor(\n code: ManifestMCPErrorCode,\n message: string,\n details?: Record<string, unknown>,\n ) {\n super(message);\n this.name = 'ManifestMCPError';\n this.code = code;\n this.details = details;\n\n // Ensure proper prototype chain for instanceof checks\n Object.setPrototypeOf(this, ManifestMCPError.prototype);\n }\n\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n code: this.code,\n message: this.message,\n details: this.details,\n };\n }\n}\n\n/**\n * Account information\n */\nexport interface AccountInfo {\n readonly address: string;\n}\n\n// ============================================================================\n// Query Result Types\n// ============================================================================\n\n/**\n * Pagination response from Cosmos SDK queries\n */\nexport interface PaginationResponse {\n readonly nextKey?: Uint8Array;\n readonly total?: bigint;\n}\n\n/**\n * Base interface for paginated query results\n */\nexport interface PaginatedResult {\n readonly pagination?: PaginationResponse;\n}\n\n/**\n * Coin type from Cosmos SDK\n */\nexport interface Coin {\n readonly denom: string;\n readonly amount: string;\n}\n\n/**\n * DecCoin type from Cosmos SDK (for rewards, commission, etc.)\n *\n * DecCoin has the same structure as Coin but represents decimal amounts\n * used in distribution calculations. The amount string may contain decimals.\n */\nexport type DecCoin = Coin;\n\n// Bank query results\nexport interface BalanceResult {\n readonly balance?: Coin;\n}\n\nexport interface BalancesResult extends PaginatedResult {\n readonly balances: readonly Coin[];\n}\n\nexport interface TotalSupplyResult extends PaginatedResult {\n readonly supply: readonly Coin[];\n}\n\nexport interface SupplyOfResult {\n readonly amount?: Coin;\n}\n\nexport interface DenomMetadataResult {\n readonly metadata?: BankMetadata;\n}\n\nexport interface DenomsMetadataResult extends PaginatedResult {\n readonly metadatas: readonly BankMetadata[];\n}\n\nexport interface SendEnabledResult extends PaginatedResult {\n readonly sendEnabled: readonly SendEnabled[];\n}\n\nexport interface BankParamsResult {\n readonly params?: BankParams;\n}\n\n// Staking query results\nexport interface DelegationResult {\n readonly delegationResponse?: DelegationResponse;\n}\n\nexport interface DelegationsResult extends PaginatedResult {\n readonly delegationResponses: readonly DelegationResponse[];\n}\n\nexport interface UnbondingDelegationResult {\n readonly unbond?: UnbondingDelegation;\n}\n\nexport interface UnbondingDelegationsResult extends PaginatedResult {\n readonly unbondingResponses: readonly UnbondingDelegation[];\n}\n\nexport interface RedelegationsResult extends PaginatedResult {\n readonly redelegationResponses: readonly RedelegationResponse[];\n}\n\nexport interface ValidatorResult {\n readonly validator?: Validator;\n}\n\nexport interface ValidatorsResult extends PaginatedResult {\n readonly validators: readonly Validator[];\n}\n\nexport interface StakingPoolResult {\n readonly pool?: StakingPool;\n}\n\nexport interface StakingParamsResult {\n readonly params?: StakingParams;\n}\n\nexport interface HistoricalInfoResult {\n readonly hist?: HistoricalInfo;\n}\n\n// Distribution query results\n// Note: When querying all rewards, 'rewards' is DelegationDelegatorReward[] (per validator).\n// When querying specific validator, 'rewards' is DecCoin[] (direct reward coins).\nexport interface RewardsResult {\n readonly rewards: readonly DecCoin[] | readonly DelegationDelegatorReward[];\n readonly total?: readonly DecCoin[];\n}\n\nexport interface CommissionResult {\n readonly commission?: ValidatorAccumulatedCommission;\n}\n\nexport interface CommunityPoolResult {\n readonly pool: readonly DecCoin[];\n}\n\nexport interface DistributionParamsResult {\n readonly params?: DistributionParams;\n}\n\nexport interface ValidatorOutstandingRewardsResult {\n readonly rewards?: ValidatorOutstandingRewards;\n}\n\nexport interface SlashesResult extends PaginatedResult {\n readonly slashes: readonly ValidatorSlashEvent[];\n}\n\nexport interface DelegatorValidatorsResult {\n readonly validators: readonly string[];\n}\n\nexport interface DelegatorWithdrawAddressResult {\n readonly withdrawAddress: string;\n}\n\n// Gov query results\nexport interface ProposalResult {\n readonly proposal?: GovProposal;\n}\n\nexport interface ProposalsResult extends PaginatedResult {\n readonly proposals: readonly GovProposal[];\n}\n\nexport interface VoteResult {\n readonly vote?: GovVote;\n}\n\nexport interface VotesResult extends PaginatedResult {\n readonly votes: readonly GovVote[];\n}\n\nexport interface DepositResult {\n readonly deposit?: GovDeposit;\n}\n\nexport interface DepositsResult extends PaginatedResult {\n readonly deposits: readonly GovDeposit[];\n}\n\nexport interface TallyResult {\n readonly tally?: GovTallyResult;\n}\n\nexport interface GovParamsResult {\n readonly votingParams?: VotingParams;\n readonly depositParams?: DepositParams;\n readonly tallyParams?: TallyParams;\n readonly params?: GovParams;\n}\n\n// Auth query results\n// Note: Account types are polymorphic - the RPC can return BaseAccount, ModuleAccount, or other account types wrapped in Any\nexport interface AuthAccountResult {\n readonly account?: BaseAccount | ModuleAccount | Any;\n}\n\nexport interface AuthAccountsResult extends PaginatedResult {\n readonly accounts: readonly (BaseAccount | Any)[];\n}\n\nexport interface AuthParamsResult {\n readonly params?: AuthParams;\n}\n\nexport interface ModuleAccountsResult {\n readonly accounts: readonly (ModuleAccount | Any)[];\n}\n\nexport interface AddressBytesToStringResult {\n readonly addressString: string;\n}\n\nexport interface AddressStringToBytesResult {\n readonly addressBytes: string;\n}\n\nexport interface Bech32PrefixResult {\n readonly bech32Prefix: string;\n}\n\nexport interface AccountInfoResult {\n readonly info?: BaseAccount;\n}\n\n// Billing query results\nexport interface BillingParamsResult {\n readonly params?: BillingParams;\n}\n\nexport interface LeaseResult {\n readonly lease?: Lease;\n}\n\nexport interface LeasesResult extends PaginatedResult {\n readonly leases: readonly Lease[];\n}\n\nexport interface CreditAccountResult {\n readonly creditAccount?: CreditAccount;\n readonly balances: readonly Coin[];\n readonly availableBalances: readonly Coin[];\n}\n\nexport interface CreditAccountsResult extends PaginatedResult {\n readonly creditAccounts: readonly CreditAccount[];\n}\n\nexport interface CreditAddressResult {\n readonly creditAddress: string;\n}\n\nexport interface WithdrawableAmountResult {\n readonly amounts: readonly Coin[];\n}\n\nexport interface ProviderWithdrawableResult {\n readonly amounts: readonly Coin[];\n readonly leaseCount: bigint;\n readonly hasMore: boolean;\n}\n\nexport interface CreditEstimateResult {\n readonly estimate: QueryCreditEstimateResponse;\n}\n\nexport interface LeaseByCustomDomainResult {\n readonly lease: Lease;\n readonly serviceName: string;\n}\n\n// Group query results\nexport interface GroupInfoResult {\n readonly info?: GroupInfo;\n}\n\nexport interface GroupPolicyInfoResult {\n readonly info?: GroupPolicyInfo;\n}\n\nexport interface GroupMembersResult extends PaginatedResult {\n readonly members: readonly GroupMember[];\n}\n\nexport interface GroupsResult extends PaginatedResult {\n readonly groups: readonly GroupInfo[];\n}\n\nexport interface GroupPoliciesResult extends PaginatedResult {\n readonly groupPolicies: readonly GroupPolicyInfo[];\n}\n\nexport interface GroupProposalResult {\n readonly proposal?: GroupProposal;\n}\n\nexport interface GroupProposalsResult extends PaginatedResult {\n readonly proposals: readonly GroupProposal[];\n}\n\nexport interface GroupVoteResult {\n readonly vote?: GroupVote;\n}\n\nexport interface GroupVotesResult extends PaginatedResult {\n readonly votes: readonly GroupVote[];\n}\n\nexport interface GroupTallyQueryResult {\n readonly tally?: GroupTallyResult;\n}\n\n// SKU query results\nexport interface SkuParamsResult {\n readonly params?: SkuParams;\n}\n\nexport interface ProviderResult {\n readonly provider?: Provider;\n}\n\nexport interface ProvidersResult extends PaginatedResult {\n readonly providers: readonly Provider[];\n}\n\nexport interface SkuResult {\n readonly sku?: SKU;\n}\n\nexport interface SkusResult extends PaginatedResult {\n readonly skus: readonly SKU[];\n}\n\n// CosmWasm query results\nexport interface WasmContractInfoResult {\n readonly address: string;\n readonly contractInfo?: ContractInfo;\n}\n\nexport interface WasmContractHistoryResult extends PaginatedResult {\n readonly entries: readonly ContractCodeHistoryEntry[];\n}\n\nexport interface WasmContractsByCodeResult extends PaginatedResult {\n readonly contracts: readonly string[];\n}\n\nexport interface WasmAllContractStateResult extends PaginatedResult {\n readonly models: readonly Model[];\n}\n\nexport interface WasmRawContractStateResult {\n readonly data: string; // base64-encoded\n}\n\nexport interface WasmSmartContractStateResult {\n readonly data: unknown;\n}\n\n/** JSON-safe representation of CodeInfoResponse with dataHash encoded as base64. */\nexport interface WasmCodeInfo {\n readonly codeId: bigint;\n readonly creator: string;\n readonly dataHash: string; // base64-encoded\n readonly instantiatePermission: {\n readonly permission: number;\n readonly addresses: readonly string[];\n };\n}\n\nexport interface WasmCodeResult {\n readonly codeInfo?: WasmCodeInfo;\n readonly data: string; // base64-encoded wasm bytecode\n}\n\nexport interface WasmCodesResult extends PaginatedResult {\n readonly codeInfos: readonly WasmCodeInfo[];\n}\n\nexport interface WasmCodeInfoResult {\n readonly codeInfo?: WasmCodeInfo;\n}\n\nexport interface WasmPinnedCodesResult extends PaginatedResult {\n readonly codeIds: readonly bigint[];\n}\n\nexport interface WasmParamsResult {\n readonly params?: WasmParams;\n}\n\nexport interface WasmContractsByCreatorResult extends PaginatedResult {\n readonly contractAddresses: readonly string[];\n}\n\nexport interface WasmLimitsConfigResult {\n readonly config: string;\n}\n\nexport interface WasmBuildAddressResult {\n readonly address: string;\n}\n\n// Proof-of-Authority (strangelove_ventures) query results\nexport interface PoAAuthorityResult {\n readonly authority: string;\n}\n\nexport interface PoAConsensusPowerResult {\n readonly consensusPower: bigint;\n}\n\nexport interface PoAPendingValidatorsResult {\n readonly pending: readonly PoAValidator[];\n}\n\n// Tokenfactory (osmosis) query results\nexport interface TokenfactoryParamsResult {\n readonly params?: TokenfactoryParams;\n}\n\nexport interface DenomAuthorityMetadataResult {\n readonly authorityMetadata?: DenomAuthorityMetadata;\n}\n\nexport interface DenomsFromCreatorResult {\n readonly denoms: readonly string[];\n}\n\nexport interface DenomsFromAdminResult {\n readonly denoms: readonly string[];\n}\n\n// Authz query results\nexport interface AuthzGrantsResult extends PaginatedResult {\n readonly grants: readonly AuthzGrant[];\n}\n\nexport interface AuthzGranterGrantsResult extends PaginatedResult {\n readonly grants: readonly AuthzGrantAuthorization[];\n}\n\nexport interface AuthzGranteeGrantsResult extends PaginatedResult {\n readonly grants: readonly AuthzGrantAuthorization[];\n}\n\n// Feegrant query results\nexport interface FeegrantAllowanceResult {\n readonly allowance?: FeegrantGrant;\n}\n\nexport interface FeegrantAllowancesResult extends PaginatedResult {\n readonly allowances: readonly FeegrantGrant[];\n}\n\n// Mint query results\nexport interface MintParamsResult {\n readonly params?: MintParams;\n}\n\nexport interface MintInflationResult {\n readonly inflation: string;\n}\n\nexport interface MintAnnualProvisionsResult {\n readonly annualProvisions: string;\n}\n\n// IBC transfer query results\nexport interface IbcDenomTraceResult {\n readonly denomTrace?: DenomTrace;\n}\n\nexport interface IbcDenomTracesResult extends PaginatedResult {\n readonly denomTraces: readonly DenomTrace[];\n}\n\nexport interface IbcTransferParamsResult {\n readonly params?: IbcTransferParams;\n}\n\n/**\n * Union type of all query results for type-safe handling\n */\nexport type QueryResult =\n | BalanceResult\n | BalancesResult\n | TotalSupplyResult\n | SupplyOfResult\n | DenomMetadataResult\n | DenomsMetadataResult\n | SendEnabledResult\n | BankParamsResult\n | DelegationResult\n | DelegationsResult\n | UnbondingDelegationResult\n | UnbondingDelegationsResult\n | RedelegationsResult\n | ValidatorResult\n | ValidatorsResult\n | StakingPoolResult\n | StakingParamsResult\n | HistoricalInfoResult\n | RewardsResult\n | CommissionResult\n | CommunityPoolResult\n | DistributionParamsResult\n | ValidatorOutstandingRewardsResult\n | SlashesResult\n | DelegatorValidatorsResult\n | DelegatorWithdrawAddressResult\n | ProposalResult\n | ProposalsResult\n | VoteResult\n | VotesResult\n | DepositResult\n | DepositsResult\n | TallyResult\n | GovParamsResult\n | AuthAccountResult\n | AuthAccountsResult\n | AuthParamsResult\n | ModuleAccountsResult\n | AddressBytesToStringResult\n | AddressStringToBytesResult\n | Bech32PrefixResult\n | AccountInfoResult\n | AuthzGrantsResult\n | AuthzGranterGrantsResult\n | AuthzGranteeGrantsResult\n | FeegrantAllowanceResult\n | FeegrantAllowancesResult\n | MintParamsResult\n | MintInflationResult\n | MintAnnualProvisionsResult\n | BillingParamsResult\n | LeaseResult\n | LeasesResult\n | CreditAccountResult\n | CreditAccountsResult\n | CreditAddressResult\n | WithdrawableAmountResult\n | ProviderWithdrawableResult\n | CreditEstimateResult\n | LeaseByCustomDomainResult\n | SkuParamsResult\n | ProviderResult\n | ProvidersResult\n | SkuResult\n | SkusResult\n | GroupInfoResult\n | GroupPolicyInfoResult\n | GroupMembersResult\n | GroupsResult\n | GroupPoliciesResult\n | GroupProposalResult\n | GroupProposalsResult\n | GroupVoteResult\n | GroupVotesResult\n | GroupTallyQueryResult\n | WasmContractInfoResult\n | WasmContractHistoryResult\n | WasmContractsByCodeResult\n | WasmAllContractStateResult\n | WasmRawContractStateResult\n | WasmSmartContractStateResult\n | WasmCodeResult\n | WasmCodesResult\n | WasmCodeInfoResult\n | WasmPinnedCodesResult\n | WasmParamsResult\n | WasmContractsByCreatorResult\n | WasmLimitsConfigResult\n | WasmBuildAddressResult\n | PoAAuthorityResult\n | PoAConsensusPowerResult\n | PoAPendingValidatorsResult\n | TokenfactoryParamsResult\n | DenomAuthorityMetadataResult\n | DenomsFromCreatorResult\n | DenomsFromAdminResult\n | IbcDenomTraceResult\n | IbcDenomTracesResult\n | IbcTransferParamsResult;\n\n/**\n * Result from a Cosmos query\n */\nexport interface CosmosQueryResult {\n readonly module: string;\n readonly subcommand: string;\n readonly result: QueryResult;\n}\n"],"mappings":";;;;AAuVA,IAAY,uBAAL,yBAAA,sBAAA;CAEL,qBAAA,oBAAA;CAGA,qBAAA,0BAAA;CACA,qBAAA,8BAAA;CACA,qBAAA,sBAAA;CAGA,qBAAA,2BAAA;CAGA,qBAAA,kBAAA;CACA,qBAAA,uBAAA;CACA,qBAAA,qBAAA;CAGA,qBAAA,eAAA;CACA,qBAAA,oBAAA;CACA,qBAAA,uBAAA;CAGA,qBAAA,oBAAA;CASA,qBAAA,yBAAA;CAOA,qBAAA,mBAAA;;AACF,EAAA,CAAA,CAAA;;;;AAKA,IAAa,mBAAb,MAAa,yBAAyB,MAAM;CAI1C,YACE,MACA,SACA,SACA;EACA,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,UAAU;EAGf,OAAO,eAAe,MAAM,iBAAiB,SAAS;CACxD;CAEA,SAAkC;EAChC,OAAO;GACL,MAAM,KAAK;GACX,MAAM,KAAK;GACX,SAAS,KAAK;GACd,SAAS,KAAK;EAChB;CACF;AACF"}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","names":[],"sources":["../src/version.ts"],"sourcesContent":["export const VERSION = '0.
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../src/version.ts"],"sourcesContent":["export const VERSION = '0.14.0';\n"],"mappings":";AAAA,MAAa,UAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manifest-network/manifest-mcp-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Shared library for Cosmos SDK blockchain logic, tool functions, and server utilities (Manifest Network)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|