@suigar/mcp 0.1.0 → 0.1.1

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/bin.cjs +1 -1
  3. package/dist/bin.mjs +1 -1
  4. package/dist/index.cjs +43 -50
  5. package/dist/index.d.cts +818 -8
  6. package/dist/index.d.mts +818 -8
  7. package/dist/index.mjs +1 -8
  8. package/{node_modules/@suigar/sui-rpc-pool/dist/index.cjs → dist/server-BD-123-u.mjs} +2084 -671
  9. package/{node_modules/@suigar/sui-rpc-pool/dist/index.mjs → dist/server-Cmo8UaHE.cjs} +2341 -645
  10. package/dist/server.cjs +3 -432
  11. package/dist/server.mjs +1 -430
  12. package/package.json +75 -61
  13. package/dist/client.cjs +0 -46
  14. package/dist/client.d.cts +0 -17
  15. package/dist/client.d.mts +0 -17
  16. package/dist/client.mjs +0 -43
  17. package/dist/coin.cjs +0 -86
  18. package/dist/coin.d.cts +0 -35
  19. package/dist/coin.d.mts +0 -35
  20. package/dist/coin.mjs +0 -86
  21. package/dist/config.cjs +0 -183
  22. package/dist/config.d.cts +0 -15
  23. package/dist/config.d.mts +0 -15
  24. package/dist/config.mjs +0 -174
  25. package/dist/mcp-support.cjs +0 -62
  26. package/dist/mcp-support.d.cts +0 -16
  27. package/dist/mcp-support.d.mts +0 -16
  28. package/dist/mcp-support.mjs +0 -60
  29. package/dist/metadata.cjs +0 -51
  30. package/dist/metadata.d.cts +0 -52
  31. package/dist/metadata.d.mts +0 -52
  32. package/dist/metadata.mjs +0 -47
  33. package/dist/tools.cjs +0 -617
  34. package/dist/tools.d.cts +0 -158
  35. package/dist/tools.d.mts +0 -158
  36. package/dist/tools.mjs +0 -608
  37. package/dist/transactions.cjs +0 -294
  38. package/dist/transactions.d.cts +0 -40
  39. package/dist/transactions.d.mts +0 -40
  40. package/dist/transactions.mjs +0 -286
  41. package/dist/types.d.cts +0 -111
  42. package/dist/types.d.mts +0 -111
  43. package/node_modules/@suigar/currency-registry/dist/index.cjs +0 -121
  44. package/node_modules/@suigar/currency-registry/dist/index.d.cts +0 -50
  45. package/node_modules/@suigar/currency-registry/dist/index.d.mts +0 -50
  46. package/node_modules/@suigar/currency-registry/dist/index.mjs +0 -110
  47. package/node_modules/@suigar/currency-registry/package.json +0 -31
  48. package/node_modules/@suigar/game-registry/dist/index.cjs +0 -310
  49. package/node_modules/@suigar/game-registry/dist/index.d.cts +0 -65
  50. package/node_modules/@suigar/game-registry/dist/index.d.mts +0 -65
  51. package/node_modules/@suigar/game-registry/dist/index.mjs +0 -292
  52. package/node_modules/@suigar/game-registry/package.json +0 -31
  53. package/node_modules/@suigar/sui-rpc-pool/dist/index.d.cts +0 -465
  54. package/node_modules/@suigar/sui-rpc-pool/dist/index.d.mts +0 -465
  55. package/node_modules/@suigar/sui-rpc-pool/package.json +0 -31
package/dist/config.mjs DELETED
@@ -1,174 +0,0 @@
1
- import { buildMcpSupportCatalog, getMcpSupportForGame } from "./mcp-support.mjs";
2
- import { buildConfiguredCurrencies, normalizeCoinTypeKey, resolveCurrencyMetadata } from "@suigar/currency-registry";
3
- import { getActiveGames } from "@suigar/game-registry";
4
- import { SuiGrpcClient } from "@mysten/sui/grpc";
5
- import { suigar } from "@suigar/sdk";
6
- //#region src/config.ts
7
- const EMPTY = "";
8
- const DEFAULT_NETWORK = "testnet";
9
- const DEFAULT_SUI_COIN_TYPE = "0x2::sui::SUI";
10
- const SDK_CONFIG_NETWORKS = /* @__PURE__ */ new Set(["mainnet", "testnet"]);
11
- const DEFAULT_GRAPHQL_URL = (network) => `https://graphql.${network}.sui.io/graphql`;
12
- const DEFAULT_PROVIDER_URL = (network) => {
13
- switch (network) {
14
- case "mainnet": return "https://fullnode.mainnet.sui.io:443";
15
- case "devnet": return "https://fullnode.devnet.sui.io:443";
16
- case "localnet": return "http://127.0.0.1:9000";
17
- default: return "https://fullnode.testnet.sui.io:443";
18
- }
19
- };
20
- const parseApiLikeUrl = (value) => value?.trim().replace(/\/+$/, "") ?? EMPTY;
21
- const trim = (value) => value?.trim() ?? EMPTY;
22
- const pickFirst = (...values) => {
23
- for (const value of values) if (typeof value === "string" && value.trim().length > 0) return value.trim();
24
- return EMPTY;
25
- };
26
- const env = (...keys) => pickFirst(...keys.map((key) => process.env[key]));
27
- const normalizeNetwork = (value) => {
28
- const normalized = value?.trim().toLowerCase();
29
- return normalized ? normalized : DEFAULT_NETWORK;
30
- };
31
- const resolveSdkConfig = (network) => {
32
- if (!SDK_CONFIG_NETWORKS.has(network)) return null;
33
- try {
34
- return new SuiGrpcClient({
35
- baseUrl: DEFAULT_PROVIDER_URL(network),
36
- network
37
- }).$extend(suigar()).suigar.getConfig();
38
- } catch {
39
- return null;
40
- }
41
- };
42
- const resolveSharedPackageId = (input) => pickFirst(input.suigarPackageId, env("SUIGAR_PACKAGE_ID", "VITE_SUIGAR_PACKAGE_ID"));
43
- const resolveSuigarConfig = (input = {}) => {
44
- const mergedInput = {
45
- ...input.config ?? {},
46
- ...input
47
- };
48
- const network = normalizeNetwork(mergedInput.network ?? env("SUIGAR_NETWORK", "VITE_NETWORK", "NETWORK"));
49
- const sdkConfig = resolveSdkConfig(network);
50
- const explicitSharedPackageId = resolveSharedPackageId(mergedInput);
51
- const sharedPackageId = pickFirst(explicitSharedPackageId, sdkConfig?.packageIds.core);
52
- return {
53
- network,
54
- providerUrl: pickFirst(mergedInput.providerUrl, env("SUIGAR_PROVIDER_URL", "VITE_SUI_GRPC_URL")) || DEFAULT_PROVIDER_URL(network),
55
- graphqlUrl: pickFirst(mergedInput.graphqlUrl, env("SUIGAR_GRAPHQL_URL", "VITE_SUI_GRAPHQL_URL")) || DEFAULT_GRAPHQL_URL(network),
56
- siteUrl: pickFirst(mergedInput.siteUrl, env("SUIGAR_SITE_URL", "VITE_SITE_URL")) || "https://suigar.com",
57
- suigarPackageId: sharedPackageId,
58
- coinflipPackageId: pickFirst(mergedInput.coinflipPackageId, env("COINFLIP_PACKAGE_ID", "VITE_COINFLIP_PACKAGE_ID"), explicitSharedPackageId, sdkConfig?.packageIds.coinflip),
59
- pvpCoinflipPackageId: pickFirst(mergedInput.pvpCoinflipPackageId, env("PVP_COINFLIP_PACKAGE_ID", "VITE_PVP_COINFLIP_PACKAGE_ID"), explicitSharedPackageId, sdkConfig?.packageIds.pvpCoinflip),
60
- plinkoPackageId: pickFirst(mergedInput.plinkoPackageId, env("PLINKO_PACKAGE_ID", "VITE_PLINKO_PACKAGE_ID"), explicitSharedPackageId, sdkConfig?.packageIds.plinko),
61
- limboPackageId: pickFirst(mergedInput.limboPackageId, env("LIMBO_PACKAGE_ID", "VITE_LIMBO_PACKAGE_ID"), explicitSharedPackageId, sdkConfig?.packageIds.limbo),
62
- rangePackageId: pickFirst(mergedInput.rangePackageId, env("RANGE_PACKAGE_ID", "VITE_RANGE_PACKAGE_ID"), explicitSharedPackageId, sdkConfig?.packageIds.range),
63
- wheelPackageId: pickFirst(mergedInput.wheelPackageId, env("WHEEL_PACKAGE_ID", "VITE_WHEEL_PACKAGE_ID"), explicitSharedPackageId, sdkConfig?.packageIds.wheel),
64
- sweethouseId: pickFirst(mergedInput.sweethouseId, env("SWEETHOUSE_ID", "VITE_SWEETHOUSE_ID"), sdkConfig?.packageIds.sweetHouse),
65
- suiCoinType: pickFirst(mergedInput.suiCoinType, env("SUI_COIN_TYPE", "VITE_SUI_COIN_TYPE"), sdkConfig?.coinTypes.sui) || DEFAULT_SUI_COIN_TYPE,
66
- usdcCoinType: pickFirst(mergedInput.usdcCoinType, env("USDC_COIN_TYPE", "VITE_USDC_COIN_TYPE"), sdkConfig?.coinTypes.usdc),
67
- suiPythPriceInfoObjectId: pickFirst(mergedInput.suiPythPriceInfoObjectId, env("SUI_PYTH_PRICE_INFO_OBJECT_ID", "VITE_SUI_PYTH_PRICE_INFO_OBJECT_ID"), sdkConfig?.priceInfoObjectIds.sui),
68
- usdcPythPriceInfoObjectId: pickFirst(mergedInput.usdcPythPriceInfoObjectId, env("USDC_PYTH_PRICE_INFO_OBJECT_ID", "VITE_USDC_PYTH_PRICE_INFO_OBJECT_ID"), sdkConfig?.priceInfoObjectIds.usdc),
69
- coinflipSettingsId: pickFirst(mergedInput.coinflipSettingsId, env("COINFLIP_SETTINGS_ID", "VITE_COINFLIP_SETTINGS_ID")),
70
- pvpCoinflipSettingsId: pickFirst(mergedInput.pvpCoinflipSettingsId, env("PVP_COINFLIP_SETTINGS_ID", "VITE_PVP_COINFLIP_SETTINGS_ID")),
71
- plinkoSettingsId: pickFirst(mergedInput.plinkoSettingsId, env("PLINKO_SETTINGS_ID", "VITE_PLINKO_SETTINGS_ID")),
72
- limboSettingsId: pickFirst(mergedInput.limboSettingsId, env("LIMBO_SETTINGS_ID", "VITE_LIMBO_SETTINGS_ID")),
73
- rangeSettingsId: pickFirst(mergedInput.rangeSettingsId, env("RANGE_SETTINGS_ID", "VITE_RANGE_SETTINGS_ID")),
74
- wheelSettingsId: pickFirst(mergedInput.wheelSettingsId, env("WHEEL_SETTINGS_ID", "VITE_WHEEL_SETTINGS_ID")),
75
- pvpCoinflipRegistryId: pickFirst(mergedInput.pvpCoinflipRegistryId, env("PVP_COINFLIP_REGISTRY_ID", "VITE_PVP_COINFLIP_REGISTRY_ID"), sdkConfig?.registryIds.pvpCoinflip)
76
- };
77
- };
78
- const REQUIRED_CONFIG_KEYS_BY_GAME = {
79
- coinflip: [
80
- "coinflipPackageId",
81
- "sweethouseId",
82
- "suiCoinType",
83
- "suiPythPriceInfoObjectId"
84
- ],
85
- limbo: [
86
- "limboPackageId",
87
- "sweethouseId",
88
- "suiCoinType",
89
- "suiPythPriceInfoObjectId"
90
- ],
91
- plinko: [
92
- "plinkoPackageId",
93
- "sweethouseId",
94
- "suiCoinType",
95
- "suiPythPriceInfoObjectId"
96
- ],
97
- wheel: [
98
- "wheelPackageId",
99
- "sweethouseId",
100
- "suiCoinType",
101
- "suiPythPriceInfoObjectId"
102
- ],
103
- range: [
104
- "rangePackageId",
105
- "sweethouseId",
106
- "suiCoinType",
107
- "suiPythPriceInfoObjectId"
108
- ],
109
- "pvp-coinflip": [
110
- "pvpCoinflipPackageId",
111
- "sweethouseId",
112
- "suiCoinType"
113
- ]
114
- };
115
- const getRequiredConfigKeysForGame = (game) => REQUIRED_CONFIG_KEYS_BY_GAME[game];
116
- const inspectResolvedConfig = (input = {}) => {
117
- const config = resolveSuigarConfig(input);
118
- const configuredCurrencies = buildConfiguredCurrencies({
119
- suiCoinType: config.suiCoinType,
120
- usdcCoinType: config.usdcCoinType
121
- });
122
- const missingValues = Object.entries(config).flatMap(([key, value]) => trim(value) ? [] : [key]);
123
- return {
124
- config,
125
- configuredCurrencies,
126
- availableGames: getActiveGames().map((game) => ({
127
- ...game,
128
- mcpSupport: getMcpSupportForGame(game.id)
129
- })),
130
- missingValues,
131
- mcp: buildMcpSupportCatalog()
132
- };
133
- };
134
- const resolvePythPriceInfoId = (coinType, configInput = {}) => {
135
- const config = resolveSuigarConfig(configInput);
136
- const normalizedCoinType = normalizeCoinTypeKey(coinType);
137
- if (normalizedCoinType === normalizeCoinTypeKey(config.suiCoinType) && config.suiPythPriceInfoObjectId) return config.suiPythPriceInfoObjectId;
138
- if ([config.usdcCoinType].filter((value) => Boolean(trim(value))).map((value) => normalizeCoinTypeKey(value)).includes(normalizedCoinType) && config.usdcPythPriceInfoObjectId) return config.usdcPythPriceInfoObjectId;
139
- if (resolveCurrencyMetadata(coinType, inspectResolvedConfig(config).configuredCurrencies).symbol === "USDC" && config.usdcPythPriceInfoObjectId) return config.usdcPythPriceInfoObjectId;
140
- throw new Error(`Missing Pyth price object configuration for coin type ${coinType}`);
141
- };
142
- const resolveGamePackageId = (game, configInput = {}) => {
143
- const config = resolveSuigarConfig(configInput);
144
- switch (game) {
145
- case "coinflip": return config.coinflipPackageId;
146
- case "limbo": return config.limboPackageId;
147
- case "plinko": return config.plinkoPackageId;
148
- case "wheel": return config.wheelPackageId;
149
- case "range": return config.rangePackageId;
150
- case "pvp-coinflip": return config.pvpCoinflipPackageId;
151
- }
152
- };
153
- const resolveGameSettingsId = (game, configInput = {}) => {
154
- const config = resolveSuigarConfig(configInput);
155
- switch (game) {
156
- case "coinflip": return config.coinflipSettingsId;
157
- case "limbo": return config.limboSettingsId;
158
- case "plinko": return config.plinkoSettingsId;
159
- case "wheel": return config.wheelSettingsId;
160
- case "range": return config.rangeSettingsId;
161
- case "pvp-coinflip": return config.pvpCoinflipSettingsId;
162
- }
163
- };
164
- const assertRequiredConfig = (game, configInput = {}) => {
165
- const inspection = inspectResolvedConfig(configInput);
166
- const missing = getRequiredConfigKeysForGame(game).filter((key) => !trim(inspection.config[key]));
167
- if (missing.length > 0) throw new Error(`Missing required config for ${game}: ${missing.join(", ")}`);
168
- return inspection.config;
169
- };
170
- const buildProviderUrl = (network) => DEFAULT_PROVIDER_URL(network);
171
- const buildGraphqlUrl = (network) => DEFAULT_GRAPHQL_URL(network);
172
- const parseApiUrl = parseApiLikeUrl;
173
- //#endregion
174
- export { assertRequiredConfig, buildGraphqlUrl, buildProviderUrl, getRequiredConfigKeysForGame, inspectResolvedConfig, parseApiUrl, resolveGamePackageId, resolveGameSettingsId, resolvePythPriceInfoId, resolveSuigarConfig };
@@ -1,62 +0,0 @@
1
- //#region src/mcp-support.ts
2
- const SUPPORTED_MCP_TOOL_NAMES = [
3
- "read_config",
4
- "read_game_metadata",
5
- "build_coinflip_transaction",
6
- "build_limbo_transaction",
7
- "build_plinko_transaction",
8
- "build_wheel_transaction",
9
- "build_range_transaction",
10
- "build_pvp_coinflip_create_transaction",
11
- "build_pvp_coinflip_join_transaction",
12
- "build_pvp_coinflip_cancel_transaction"
13
- ];
14
- const GAME_MCP_SUPPORT_BY_ID = {
15
- coinflip: {
16
- executionSurface: "onchain",
17
- toolSupported: true,
18
- primaryToolName: "build_coinflip_transaction"
19
- },
20
- limbo: {
21
- executionSurface: "onchain",
22
- toolSupported: true,
23
- primaryToolName: "build_limbo_transaction"
24
- },
25
- plinko: {
26
- executionSurface: "onchain",
27
- toolSupported: true,
28
- primaryToolName: "build_plinko_transaction"
29
- },
30
- wheel: {
31
- executionSurface: "onchain",
32
- toolSupported: true,
33
- primaryToolName: "build_wheel_transaction"
34
- },
35
- range: {
36
- executionSurface: "onchain",
37
- toolSupported: true,
38
- primaryToolName: "build_range_transaction"
39
- },
40
- "pvp-coinflip": {
41
- executionSurface: "onchain",
42
- toolSupported: true,
43
- primaryToolName: "build_pvp_coinflip_create_transaction"
44
- }
45
- };
46
- const getMcpSupportForGame = (gameId) => {
47
- const support = GAME_MCP_SUPPORT_BY_ID[gameId];
48
- if (support) return support;
49
- return {
50
- executionSurface: gameId === "slots" ? "backend" : "onchain",
51
- toolSupported: false,
52
- primaryToolName: null
53
- };
54
- };
55
- const buildMcpSupportCatalog = () => Object.freeze({
56
- serverName: "suigar",
57
- supportedToolNames: [...SUPPORTED_MCP_TOOL_NAMES]
58
- });
59
- //#endregion
60
- exports.SUPPORTED_MCP_TOOL_NAMES = SUPPORTED_MCP_TOOL_NAMES;
61
- exports.buildMcpSupportCatalog = buildMcpSupportCatalog;
62
- exports.getMcpSupportForGame = getMcpSupportForGame;
@@ -1,16 +0,0 @@
1
- //#region src/mcp-support.d.ts
2
- type SuigarMcpToolName = 'read_config' | 'read_game_metadata' | 'build_coinflip_transaction' | 'build_limbo_transaction' | 'build_plinko_transaction' | 'build_wheel_transaction' | 'build_range_transaction' | 'build_pvp_coinflip_create_transaction' | 'build_pvp_coinflip_join_transaction' | 'build_pvp_coinflip_cancel_transaction';
3
- type McpExecutionSurface = 'onchain' | 'backend';
4
- type GameMcpSupport = {
5
- executionSurface: McpExecutionSurface;
6
- toolSupported: boolean;
7
- primaryToolName: SuigarMcpToolName | null;
8
- };
9
- declare const SUPPORTED_MCP_TOOL_NAMES: SuigarMcpToolName[];
10
- declare const getMcpSupportForGame: (gameId: string) => GameMcpSupport;
11
- declare const buildMcpSupportCatalog: () => Readonly<{
12
- serverName: "suigar";
13
- supportedToolNames: SuigarMcpToolName[];
14
- }>;
15
- //#endregion
16
- export { GameMcpSupport, McpExecutionSurface, SUPPORTED_MCP_TOOL_NAMES, SuigarMcpToolName, buildMcpSupportCatalog, getMcpSupportForGame };
@@ -1,16 +0,0 @@
1
- //#region src/mcp-support.d.ts
2
- type SuigarMcpToolName = 'read_config' | 'read_game_metadata' | 'build_coinflip_transaction' | 'build_limbo_transaction' | 'build_plinko_transaction' | 'build_wheel_transaction' | 'build_range_transaction' | 'build_pvp_coinflip_create_transaction' | 'build_pvp_coinflip_join_transaction' | 'build_pvp_coinflip_cancel_transaction';
3
- type McpExecutionSurface = 'onchain' | 'backend';
4
- type GameMcpSupport = {
5
- executionSurface: McpExecutionSurface;
6
- toolSupported: boolean;
7
- primaryToolName: SuigarMcpToolName | null;
8
- };
9
- declare const SUPPORTED_MCP_TOOL_NAMES: SuigarMcpToolName[];
10
- declare const getMcpSupportForGame: (gameId: string) => GameMcpSupport;
11
- declare const buildMcpSupportCatalog: () => Readonly<{
12
- serverName: "suigar";
13
- supportedToolNames: SuigarMcpToolName[];
14
- }>;
15
- //#endregion
16
- export { GameMcpSupport, McpExecutionSurface, SUPPORTED_MCP_TOOL_NAMES, SuigarMcpToolName, buildMcpSupportCatalog, getMcpSupportForGame };
@@ -1,60 +0,0 @@
1
- //#region src/mcp-support.ts
2
- const SUPPORTED_MCP_TOOL_NAMES = [
3
- "read_config",
4
- "read_game_metadata",
5
- "build_coinflip_transaction",
6
- "build_limbo_transaction",
7
- "build_plinko_transaction",
8
- "build_wheel_transaction",
9
- "build_range_transaction",
10
- "build_pvp_coinflip_create_transaction",
11
- "build_pvp_coinflip_join_transaction",
12
- "build_pvp_coinflip_cancel_transaction"
13
- ];
14
- const GAME_MCP_SUPPORT_BY_ID = {
15
- coinflip: {
16
- executionSurface: "onchain",
17
- toolSupported: true,
18
- primaryToolName: "build_coinflip_transaction"
19
- },
20
- limbo: {
21
- executionSurface: "onchain",
22
- toolSupported: true,
23
- primaryToolName: "build_limbo_transaction"
24
- },
25
- plinko: {
26
- executionSurface: "onchain",
27
- toolSupported: true,
28
- primaryToolName: "build_plinko_transaction"
29
- },
30
- wheel: {
31
- executionSurface: "onchain",
32
- toolSupported: true,
33
- primaryToolName: "build_wheel_transaction"
34
- },
35
- range: {
36
- executionSurface: "onchain",
37
- toolSupported: true,
38
- primaryToolName: "build_range_transaction"
39
- },
40
- "pvp-coinflip": {
41
- executionSurface: "onchain",
42
- toolSupported: true,
43
- primaryToolName: "build_pvp_coinflip_create_transaction"
44
- }
45
- };
46
- const getMcpSupportForGame = (gameId) => {
47
- const support = GAME_MCP_SUPPORT_BY_ID[gameId];
48
- if (support) return support;
49
- return {
50
- executionSurface: gameId === "slots" ? "backend" : "onchain",
51
- toolSupported: false,
52
- primaryToolName: null
53
- };
54
- };
55
- const buildMcpSupportCatalog = () => Object.freeze({
56
- serverName: "suigar",
57
- supportedToolNames: [...SUPPORTED_MCP_TOOL_NAMES]
58
- });
59
- //#endregion
60
- export { SUPPORTED_MCP_TOOL_NAMES, buildMcpSupportCatalog, getMcpSupportForGame };
package/dist/metadata.cjs DELETED
@@ -1,51 +0,0 @@
1
- const require_mcp_support = require("./mcp-support.cjs");
2
- const require_config = require("./config.cjs");
3
- let _suigar_currency_registry = require("@suigar/currency-registry");
4
- let _suigar_game_registry = require("@suigar/game-registry");
5
- //#region src/metadata.ts
6
- const listSupportedGames = ({ activeOnly = true } = {}) => (activeOnly ? (0, _suigar_game_registry.getActiveGames)() : (0, _suigar_game_registry.getActiveGames)()).map((game) => ({
7
- ...game,
8
- mcpSupport: require_mcp_support.getMcpSupportForGame(game.id)
9
- }));
10
- const getGameMetadata = (game, configInput = {}) => {
11
- const resolvedGame = (0, _suigar_game_registry.getGameById)(game) ?? (0, _suigar_game_registry.getGameByAlias)(game);
12
- if (!resolvedGame) throw new Error(`Unsupported game: ${game}`);
13
- const mcpSupport = require_mcp_support.getMcpSupportForGame(resolvedGame.id);
14
- const supportedGameId = mcpSupport.toolSupported ? resolvedGame.id : null;
15
- const packageId = supportedGameId ? require_config.resolveGamePackageId(supportedGameId, configInput) : null;
16
- const settingsDefinition = (0, _suigar_game_registry.getOnchainGameSettingsDefinition)(resolvedGame.id);
17
- const settingsId = supportedGameId ? require_config.resolveGameSettingsId(supportedGameId, configInput) : null;
18
- return {
19
- ...resolvedGame,
20
- mcpSupport,
21
- packageId,
22
- settingsId,
23
- onchainSettings: packageId && settingsDefinition ? {
24
- definition: settingsDefinition,
25
- objectType: (0, _suigar_game_registry.buildOnchainGameSettingsObjectType)(packageId, settingsDefinition),
26
- parametersTypePrefix: (0, _suigar_game_registry.buildOnchainGameParametersTypePrefix)(packageId, settingsDefinition)
27
- } : null
28
- };
29
- };
30
- const listConfiguredCurrencies = (configInput = {}) => {
31
- const inspection = require_config.inspectResolvedConfig(configInput);
32
- return (0, _suigar_currency_registry.buildConfiguredCurrencies)({
33
- suiCoinType: inspection.config.suiCoinType,
34
- usdcCoinType: inspection.config.usdcCoinType
35
- });
36
- };
37
- const getCurrencyInfo = (coinType, configInput = {}) => {
38
- const configuredCurrencies = listConfiguredCurrencies(configInput);
39
- return {
40
- coinType,
41
- configuredCurrencies,
42
- metadata: (0, _suigar_currency_registry.resolveCurrencyMetadata)(coinType, configuredCurrencies)
43
- };
44
- };
45
- const readConfigMetadata = (configInput = {}) => require_config.inspectResolvedConfig(configInput);
46
- //#endregion
47
- exports.getCurrencyInfo = getCurrencyInfo;
48
- exports.getGameMetadata = getGameMetadata;
49
- exports.listConfiguredCurrencies = listConfiguredCurrencies;
50
- exports.listSupportedGames = listSupportedGames;
51
- exports.readConfigMetadata = readConfigMetadata;
@@ -1,52 +0,0 @@
1
- import { GameMcpSupport } from "./mcp-support.cjs";
2
- import { ConfigInspection, SuigarConfigInput } from "./types.cjs";
3
-
4
- //#region src/metadata.d.ts
5
- declare const listSupportedGames: ({
6
- activeOnly
7
- }?: {
8
- activeOnly?: boolean;
9
- }) => {
10
- mcpSupport: GameMcpSupport;
11
- id: import("@suigar/game-registry").GameId;
12
- name: string;
13
- module: import("@suigar/game-registry").GameModule;
14
- eventTypeName: string;
15
- description?: string;
16
- aliases: string[];
17
- tags?: string[];
18
- status?: import("@suigar/game-registry").GameStatus;
19
- updatedAt?: string;
20
- }[];
21
- declare const getGameMetadata: (game: string, configInput?: SuigarConfigInput) => {
22
- mcpSupport: GameMcpSupport;
23
- packageId: string | null;
24
- settingsId: string | null;
25
- onchainSettings: {
26
- definition: import("@suigar/game-registry").OnchainGameSettingsDefinition;
27
- objectType: string;
28
- parametersTypePrefix: string;
29
- } | null;
30
- id: import("@suigar/game-registry").GameId;
31
- name: string;
32
- module: import("@suigar/game-registry").GameModule;
33
- eventTypeName: string;
34
- description?: string;
35
- aliases: string[];
36
- tags?: string[];
37
- status?: import("@suigar/game-registry").GameStatus;
38
- updatedAt?: string;
39
- };
40
- declare const listConfiguredCurrencies: (configInput?: SuigarConfigInput) => import("@suigar/currency-registry").ConfiguredCurrencyEntry[];
41
- declare const getCurrencyInfo: (coinType: string, configInput?: SuigarConfigInput) => {
42
- coinType: string;
43
- configuredCurrencies: import("@suigar/currency-registry").ConfiguredCurrencyEntry[];
44
- metadata: {
45
- symbol: string;
46
- name: string;
47
- decimals: number;
48
- };
49
- };
50
- declare const readConfigMetadata: (configInput?: SuigarConfigInput) => ConfigInspection;
51
- //#endregion
52
- export { getCurrencyInfo, getGameMetadata, listConfiguredCurrencies, listSupportedGames, readConfigMetadata };
@@ -1,52 +0,0 @@
1
- import { GameMcpSupport } from "./mcp-support.mjs";
2
- import { ConfigInspection, SuigarConfigInput } from "./types.mjs";
3
-
4
- //#region src/metadata.d.ts
5
- declare const listSupportedGames: ({
6
- activeOnly
7
- }?: {
8
- activeOnly?: boolean;
9
- }) => {
10
- mcpSupport: GameMcpSupport;
11
- id: import("@suigar/game-registry").GameId;
12
- name: string;
13
- module: import("@suigar/game-registry").GameModule;
14
- eventTypeName: string;
15
- description?: string;
16
- aliases: string[];
17
- tags?: string[];
18
- status?: import("@suigar/game-registry").GameStatus;
19
- updatedAt?: string;
20
- }[];
21
- declare const getGameMetadata: (game: string, configInput?: SuigarConfigInput) => {
22
- mcpSupport: GameMcpSupport;
23
- packageId: string | null;
24
- settingsId: string | null;
25
- onchainSettings: {
26
- definition: import("@suigar/game-registry").OnchainGameSettingsDefinition;
27
- objectType: string;
28
- parametersTypePrefix: string;
29
- } | null;
30
- id: import("@suigar/game-registry").GameId;
31
- name: string;
32
- module: import("@suigar/game-registry").GameModule;
33
- eventTypeName: string;
34
- description?: string;
35
- aliases: string[];
36
- tags?: string[];
37
- status?: import("@suigar/game-registry").GameStatus;
38
- updatedAt?: string;
39
- };
40
- declare const listConfiguredCurrencies: (configInput?: SuigarConfigInput) => import("@suigar/currency-registry").ConfiguredCurrencyEntry[];
41
- declare const getCurrencyInfo: (coinType: string, configInput?: SuigarConfigInput) => {
42
- coinType: string;
43
- configuredCurrencies: import("@suigar/currency-registry").ConfiguredCurrencyEntry[];
44
- metadata: {
45
- symbol: string;
46
- name: string;
47
- decimals: number;
48
- };
49
- };
50
- declare const readConfigMetadata: (configInput?: SuigarConfigInput) => ConfigInspection;
51
- //#endregion
52
- export { getCurrencyInfo, getGameMetadata, listConfiguredCurrencies, listSupportedGames, readConfigMetadata };
package/dist/metadata.mjs DELETED
@@ -1,47 +0,0 @@
1
- import { getMcpSupportForGame } from "./mcp-support.mjs";
2
- import { inspectResolvedConfig, resolveGamePackageId, resolveGameSettingsId } from "./config.mjs";
3
- import { buildConfiguredCurrencies, resolveCurrencyMetadata } from "@suigar/currency-registry";
4
- import { buildOnchainGameParametersTypePrefix, buildOnchainGameSettingsObjectType, getActiveGames, getGameByAlias, getGameById, getOnchainGameSettingsDefinition } from "@suigar/game-registry";
5
- //#region src/metadata.ts
6
- const listSupportedGames = ({ activeOnly = true } = {}) => (activeOnly ? getActiveGames() : getActiveGames()).map((game) => ({
7
- ...game,
8
- mcpSupport: getMcpSupportForGame(game.id)
9
- }));
10
- const getGameMetadata = (game, configInput = {}) => {
11
- const resolvedGame = getGameById(game) ?? getGameByAlias(game);
12
- if (!resolvedGame) throw new Error(`Unsupported game: ${game}`);
13
- const mcpSupport = getMcpSupportForGame(resolvedGame.id);
14
- const supportedGameId = mcpSupport.toolSupported ? resolvedGame.id : null;
15
- const packageId = supportedGameId ? resolveGamePackageId(supportedGameId, configInput) : null;
16
- const settingsDefinition = getOnchainGameSettingsDefinition(resolvedGame.id);
17
- const settingsId = supportedGameId ? resolveGameSettingsId(supportedGameId, configInput) : null;
18
- return {
19
- ...resolvedGame,
20
- mcpSupport,
21
- packageId,
22
- settingsId,
23
- onchainSettings: packageId && settingsDefinition ? {
24
- definition: settingsDefinition,
25
- objectType: buildOnchainGameSettingsObjectType(packageId, settingsDefinition),
26
- parametersTypePrefix: buildOnchainGameParametersTypePrefix(packageId, settingsDefinition)
27
- } : null
28
- };
29
- };
30
- const listConfiguredCurrencies = (configInput = {}) => {
31
- const inspection = inspectResolvedConfig(configInput);
32
- return buildConfiguredCurrencies({
33
- suiCoinType: inspection.config.suiCoinType,
34
- usdcCoinType: inspection.config.usdcCoinType
35
- });
36
- };
37
- const getCurrencyInfo = (coinType, configInput = {}) => {
38
- const configuredCurrencies = listConfiguredCurrencies(configInput);
39
- return {
40
- coinType,
41
- configuredCurrencies,
42
- metadata: resolveCurrencyMetadata(coinType, configuredCurrencies)
43
- };
44
- };
45
- const readConfigMetadata = (configInput = {}) => inspectResolvedConfig(configInput);
46
- //#endregion
47
- export { getCurrencyInfo, getGameMetadata, listConfiguredCurrencies, listSupportedGames, readConfigMetadata };