@suigar/mcp 0.1.0 → 0.2.0-beta.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/LICENSE +201 -0
  3. package/README.md +79 -110
  4. package/dist/app/index.html +181 -0
  5. package/dist/bin.mjs +3 -7
  6. package/dist/bin.mjs.map +1 -0
  7. package/dist/client.d.mts +41 -11
  8. package/dist/client.d.mts.map +1 -0
  9. package/dist/client.mjs +107 -34
  10. package/dist/client.mjs.map +1 -0
  11. package/dist/dry-run.mjs +163 -0
  12. package/dist/dry-run.mjs.map +1 -0
  13. package/dist/format.mjs +24 -0
  14. package/dist/format.mjs.map +1 -0
  15. package/dist/index.d.mts +5 -9
  16. package/dist/index.mjs +4 -8
  17. package/dist/schemas.d.mts +642 -0
  18. package/dist/schemas.d.mts.map +1 -0
  19. package/dist/schemas.mjs +113 -0
  20. package/dist/schemas.mjs.map +1 -0
  21. package/dist/server.d.mts +21 -69
  22. package/dist/server.d.mts.map +1 -0
  23. package/dist/server.mjs +172 -411
  24. package/dist/server.mjs.map +1 -0
  25. package/dist/tools.d.mts +14 -155
  26. package/dist/tools.d.mts.map +1 -0
  27. package/dist/tools.mjs +297 -553
  28. package/dist/tools.mjs.map +1 -0
  29. package/dist/types.d.mts +109 -83
  30. package/dist/types.d.mts.map +1 -0
  31. package/package.json +83 -61
  32. package/dist/bin.cjs +0 -11
  33. package/dist/bin.d.cts +0 -1
  34. package/dist/client.cjs +0 -46
  35. package/dist/client.d.cts +0 -17
  36. package/dist/coin.cjs +0 -86
  37. package/dist/coin.d.cts +0 -35
  38. package/dist/coin.d.mts +0 -35
  39. package/dist/coin.mjs +0 -86
  40. package/dist/config.cjs +0 -183
  41. package/dist/config.d.cts +0 -15
  42. package/dist/config.d.mts +0 -15
  43. package/dist/config.mjs +0 -174
  44. package/dist/index.cjs +0 -53
  45. package/dist/index.d.cts +0 -10
  46. package/dist/mcp-support.cjs +0 -62
  47. package/dist/mcp-support.d.cts +0 -16
  48. package/dist/mcp-support.d.mts +0 -16
  49. package/dist/mcp-support.mjs +0 -60
  50. package/dist/metadata.cjs +0 -51
  51. package/dist/metadata.d.cts +0 -52
  52. package/dist/metadata.d.mts +0 -52
  53. package/dist/metadata.mjs +0 -47
  54. package/dist/server.cjs +0 -433
  55. package/dist/server.d.cts +0 -73
  56. package/dist/tools.cjs +0 -617
  57. package/dist/tools.d.cts +0 -158
  58. package/dist/transactions.cjs +0 -294
  59. package/dist/transactions.d.cts +0 -40
  60. package/dist/transactions.d.mts +0 -40
  61. package/dist/transactions.mjs +0 -286
  62. package/dist/types.d.cts +0 -111
  63. package/node_modules/@suigar/currency-registry/dist/index.cjs +0 -121
  64. package/node_modules/@suigar/currency-registry/dist/index.d.cts +0 -50
  65. package/node_modules/@suigar/currency-registry/dist/index.d.mts +0 -50
  66. package/node_modules/@suigar/currency-registry/dist/index.mjs +0 -110
  67. package/node_modules/@suigar/currency-registry/package.json +0 -31
  68. package/node_modules/@suigar/game-registry/dist/index.cjs +0 -310
  69. package/node_modules/@suigar/game-registry/dist/index.d.cts +0 -65
  70. package/node_modules/@suigar/game-registry/dist/index.d.mts +0 -65
  71. package/node_modules/@suigar/game-registry/dist/index.mjs +0 -292
  72. package/node_modules/@suigar/game-registry/package.json +0 -31
  73. package/node_modules/@suigar/sui-rpc-pool/dist/index.cjs +0 -45590
  74. package/node_modules/@suigar/sui-rpc-pool/dist/index.d.cts +0 -465
  75. package/node_modules/@suigar/sui-rpc-pool/dist/index.d.mts +0 -465
  76. package/node_modules/@suigar/sui-rpc-pool/dist/index.mjs +0 -45570
  77. package/node_modules/@suigar/sui-rpc-pool/package.json +0 -31
package/dist/tools.d.cts DELETED
@@ -1,158 +0,0 @@
1
- import { GameMcpSupport } from "./mcp-support.cjs";
2
- import { ConfigInspection, ReadOnlyPlan, SuigarNetwork, TransactionSummary } from "./types.cjs";
3
-
4
- //#region src/tools.d.ts
5
- declare const readConfigTool: (input?: unknown) => Promise<ConfigInspection>;
6
- declare const readGameMetadataTool: (input?: unknown) => Promise<{
7
- config: ConfigInspection;
8
- game: {
9
- mcpSupport: GameMcpSupport;
10
- packageId: string | null;
11
- settingsId: string | null;
12
- onchainSettings: {
13
- definition: import("@suigar/game-registry").OnchainGameSettingsDefinition;
14
- objectType: string;
15
- parametersTypePrefix: string;
16
- } | null;
17
- id: import("@suigar/game-registry").GameId;
18
- name: string;
19
- module: import("@suigar/game-registry").GameModule;
20
- eventTypeName: string;
21
- description?: string;
22
- aliases: string[];
23
- tags?: string[];
24
- status?: import("@suigar/game-registry").GameStatus;
25
- updatedAt?: string;
26
- } | null;
27
- currency: {
28
- coinType: string;
29
- configuredCurrencies: import("@suigar/currency-registry").ConfiguredCurrencyEntry[];
30
- metadata: {
31
- symbol: string;
32
- name: string;
33
- decimals: number;
34
- };
35
- } | null;
36
- }>;
37
- declare const buildCoinflipTransactionTool: (input?: unknown) => Promise<ReadOnlyPlan | {
38
- mode: "dry-run";
39
- network: SuigarNetwork;
40
- config: ConfigInspection;
41
- summary: TransactionSummary;
42
- dryRun: unknown;
43
- transactionBytesBase64?: undefined;
44
- } | {
45
- mode: "build" | "read-only";
46
- network: SuigarNetwork;
47
- config: ConfigInspection;
48
- summary: TransactionSummary;
49
- transactionBytesBase64: string;
50
- dryRun?: undefined;
51
- }>;
52
- declare const buildLimboTransactionTool: (input?: unknown) => Promise<ReadOnlyPlan | {
53
- mode: "dry-run";
54
- network: SuigarNetwork;
55
- config: ConfigInspection;
56
- summary: TransactionSummary;
57
- dryRun: unknown;
58
- transactionBytesBase64?: undefined;
59
- } | {
60
- mode: "build" | "read-only";
61
- network: SuigarNetwork;
62
- config: ConfigInspection;
63
- summary: TransactionSummary;
64
- transactionBytesBase64: string;
65
- dryRun?: undefined;
66
- }>;
67
- declare const buildPlinkoTransactionTool: (input?: unknown) => Promise<ReadOnlyPlan | {
68
- mode: "dry-run";
69
- network: SuigarNetwork;
70
- config: ConfigInspection;
71
- summary: TransactionSummary;
72
- dryRun: unknown;
73
- transactionBytesBase64?: undefined;
74
- } | {
75
- mode: "build" | "read-only";
76
- network: SuigarNetwork;
77
- config: ConfigInspection;
78
- summary: TransactionSummary;
79
- transactionBytesBase64: string;
80
- dryRun?: undefined;
81
- }>;
82
- declare const buildWheelTransactionTool: (input?: unknown) => Promise<ReadOnlyPlan | {
83
- mode: "dry-run";
84
- network: SuigarNetwork;
85
- config: ConfigInspection;
86
- summary: TransactionSummary;
87
- dryRun: unknown;
88
- transactionBytesBase64?: undefined;
89
- } | {
90
- mode: "build" | "read-only";
91
- network: SuigarNetwork;
92
- config: ConfigInspection;
93
- summary: TransactionSummary;
94
- transactionBytesBase64: string;
95
- dryRun?: undefined;
96
- }>;
97
- declare const buildRangeTransactionTool: (input?: unknown) => Promise<ReadOnlyPlan | {
98
- mode: "dry-run";
99
- network: SuigarNetwork;
100
- config: ConfigInspection;
101
- summary: TransactionSummary;
102
- dryRun: unknown;
103
- transactionBytesBase64?: undefined;
104
- } | {
105
- mode: "build" | "read-only";
106
- network: SuigarNetwork;
107
- config: ConfigInspection;
108
- summary: TransactionSummary;
109
- transactionBytesBase64: string;
110
- dryRun?: undefined;
111
- }>;
112
- declare const buildPvpCoinflipCreateTransactionTool: (input?: unknown) => Promise<ReadOnlyPlan | {
113
- mode: "dry-run";
114
- network: SuigarNetwork;
115
- config: ConfigInspection;
116
- summary: TransactionSummary;
117
- dryRun: unknown;
118
- transactionBytesBase64?: undefined;
119
- } | {
120
- mode: "build" | "read-only";
121
- network: SuigarNetwork;
122
- config: ConfigInspection;
123
- summary: TransactionSummary;
124
- transactionBytesBase64: string;
125
- dryRun?: undefined;
126
- }>;
127
- declare const buildPvpCoinflipJoinTransactionTool: (input?: unknown) => Promise<ReadOnlyPlan | {
128
- mode: "dry-run";
129
- network: SuigarNetwork;
130
- config: ConfigInspection;
131
- summary: TransactionSummary;
132
- dryRun: unknown;
133
- transactionBytesBase64?: undefined;
134
- } | {
135
- mode: "build" | "read-only";
136
- network: SuigarNetwork;
137
- config: ConfigInspection;
138
- summary: TransactionSummary;
139
- transactionBytesBase64: string;
140
- dryRun?: undefined;
141
- }>;
142
- declare const buildPvpCoinflipCancelTransactionTool: (input?: unknown) => Promise<ReadOnlyPlan | {
143
- mode: "dry-run";
144
- network: SuigarNetwork;
145
- config: ConfigInspection;
146
- summary: TransactionSummary;
147
- dryRun: unknown;
148
- transactionBytesBase64?: undefined;
149
- } | {
150
- mode: "build" | "read-only";
151
- network: SuigarNetwork;
152
- config: ConfigInspection;
153
- summary: TransactionSummary;
154
- transactionBytesBase64: string;
155
- dryRun?: undefined;
156
- }>;
157
- //#endregion
158
- export { buildCoinflipTransactionTool, buildLimboTransactionTool, buildPlinkoTransactionTool, buildPvpCoinflipCancelTransactionTool, buildPvpCoinflipCreateTransactionTool, buildPvpCoinflipJoinTransactionTool, buildRangeTransactionTool, buildWheelTransactionTool, readConfigTool, readGameMetadataTool };
@@ -1,294 +0,0 @@
1
- const require_config = require("./config.cjs");
2
- const require_coin = require("./coin.cjs");
3
- let _suigar_currency_registry = require("@suigar/currency-registry");
4
- let _mysten_sui_utils = require("@mysten/sui/utils");
5
- let _suigar_sdk_utils = require("@suigar/sdk/utils");
6
- let _mysten_sui_transactions = require("@mysten/sui/transactions");
7
- //#region src/transactions.ts
8
- const ADDRESS_METADATA_KEYS = /* @__PURE__ */ new Set(["referrer", "partner"]);
9
- const RESERVED_METADATA_KEYS = /* @__PURE__ */ new Set(["referrer", "partner"]);
10
- const textEncoder = new TextEncoder();
11
- const normalizeOwner = (value) => (0, _mysten_sui_utils.normalizeSuiAddress)(value);
12
- const normalizePartner = (value) => (0, _mysten_sui_utils.normalizeSuiAddress)(value);
13
- const resolveBetMetadata = (metadata, partner) => {
14
- const resolvedEntries = Object.entries(metadata ?? {}).filter(([key, value]) => {
15
- if (value === void 0 || value === null) return false;
16
- return !RESERVED_METADATA_KEYS.has(key);
17
- });
18
- if (partner?.trim()) resolvedEntries.unshift(["partner", normalizePartner(partner.trim())]);
19
- if (resolvedEntries.length === 0) return;
20
- return Object.fromEntries(resolvedEntries);
21
- };
22
- const parseHexAddress = (value) => {
23
- const trimmed = value.trim();
24
- if (!trimmed) return null;
25
- const hexBody = trimmed.startsWith("0x") || trimmed.startsWith("0X") ? trimmed.slice(2) : trimmed;
26
- if (!/^[0-9a-fA-F]+$/.test(hexBody) || hexBody.length > 64) return null;
27
- const padded = (hexBody.length % 2 === 1 ? `0${hexBody}` : hexBody).padStart(64, "0");
28
- const bytes = new Uint8Array(padded.length / 2);
29
- for (let index = 0; index < padded.length; index += 2) bytes[index / 2] = Number.parseInt(padded.slice(index, index + 2), 16);
30
- return bytes;
31
- };
32
- const encodeBetMetadata = (metadata) => {
33
- const keys = [];
34
- const values = [];
35
- for (const [key, value] of Object.entries(metadata ?? {})) {
36
- if (value === void 0 || value === null) continue;
37
- let encodedValue;
38
- if (value instanceof Uint8Array) encodedValue = Array.from(value);
39
- else if (Array.isArray(value)) encodedValue = value;
40
- else if (typeof value === "string" && ADDRESS_METADATA_KEYS.has(key)) encodedValue = Array.from(parseHexAddress(value) ?? textEncoder.encode(String(value)));
41
- else encodedValue = Array.from(textEncoder.encode(String(value)));
42
- keys.push(key);
43
- values.push(encodedValue);
44
- }
45
- return {
46
- keys,
47
- values
48
- };
49
- };
50
- const getGameGasBudget = (_game) => _suigar_sdk_utils.DEFAULT_GAS_BUDGET_MIST;
51
- const applyCommonTransactionDefaults = ({ transaction, owner, gasBudget, game }) => {
52
- transaction.setSenderIfNotSet(normalizeOwner(owner));
53
- transaction.setGasBudget(Number(gasBudget ?? getGameGasBudget(game)));
54
- return transaction;
55
- };
56
- const buildGenericBetTransaction = async ({ game, owner, coinType, stake, cashStake, betCount, metadata, config: configInput, client, coinSource, gasBudget, sender, partner, allowGasCoinShortcut = true, target, extraArgs }) => {
57
- const config = require_config.assertRequiredConfig(game, configInput);
58
- const tx = new _mysten_sui_transactions.Transaction();
59
- const normalizedOwner = normalizeOwner(sender ?? owner);
60
- const normalizedCoinType = (0, _suigar_currency_registry.normalizeCoinType)(coinType);
61
- const resolvedStake = (0, _suigar_sdk_utils.toBigInt)(stake);
62
- const resolvedCashStake = (0, _suigar_sdk_utils.toBigInt)(cashStake ?? stake);
63
- const resolvedBetCount = (0, _suigar_sdk_utils.toBigInt)(betCount ?? 1);
64
- const encodedMetadata = encodeBetMetadata(resolveBetMetadata(metadata, partner));
65
- const pythPriceInfoObjectId = require_config.resolvePythPriceInfoId(normalizedCoinType, config);
66
- tx.setSenderIfNotSet(normalizedOwner);
67
- const betCoin = await require_coin.resolveBetCoin({
68
- tx,
69
- coinType: normalizedCoinType,
70
- amount: resolvedCashStake,
71
- suiCoinType: config.suiCoinType,
72
- coinSource,
73
- client,
74
- owner: normalizedOwner,
75
- allowGasCoinShortcut
76
- });
77
- const rewardCoin = tx.moveCall({
78
- target,
79
- typeArguments: [normalizedCoinType],
80
- arguments: [
81
- tx.object(config.sweethouseId),
82
- tx.pure.u64(resolvedStake),
83
- betCoin,
84
- tx.pure.u64(resolvedBetCount),
85
- ...extraArgs(tx),
86
- tx.pure.vector("string", encodedMetadata.keys),
87
- tx.pure.vector("vector<u8>", encodedMetadata.values),
88
- tx.object(pythPriceInfoObjectId),
89
- tx.object(_mysten_sui_utils.SUI_CLOCK_OBJECT_ID),
90
- tx.object(_mysten_sui_utils.SUI_RANDOM_OBJECT_ID)
91
- ]
92
- });
93
- tx.transferObjects([rewardCoin], tx.pure.address(normalizedOwner));
94
- applyCommonTransactionDefaults({
95
- transaction: tx,
96
- owner: normalizedOwner,
97
- gasBudget,
98
- game
99
- });
100
- return tx;
101
- };
102
- const buildCoinflipTransaction = (args) => {
103
- const config = require_config.resolveSuigarConfig(args.config);
104
- return buildGenericBetTransaction({
105
- ...args,
106
- config,
107
- game: "coinflip",
108
- target: `${config.coinflipPackageId}::coinflip::play`,
109
- extraArgs: (tx) => [tx.pure.bool(args.side === "tails")]
110
- });
111
- };
112
- const buildLimboTransaction = (args) => {
113
- const config = require_config.resolveSuigarConfig(args.config);
114
- const numerator = Math.round(args.targetMultiplier * _suigar_sdk_utils.DEFAULT_LIMBO_MULTIPLIER_SCALE);
115
- const denominator = _suigar_sdk_utils.DEFAULT_LIMBO_MULTIPLIER_SCALE;
116
- return buildGenericBetTransaction({
117
- ...args,
118
- config,
119
- game: "limbo",
120
- target: `${config.limboPackageId}::limbo::play`,
121
- extraArgs: (tx) => [tx.pure.u64(BigInt(numerator)), tx.pure.u64(BigInt(denominator))]
122
- });
123
- };
124
- const buildPlinkoTransaction = (args) => {
125
- const config = require_config.resolveSuigarConfig(args.config);
126
- const configId = (0, _suigar_sdk_utils.toU8)(args.configId);
127
- return buildGenericBetTransaction({
128
- ...args,
129
- config,
130
- game: "plinko",
131
- target: `${config.plinkoPackageId}::plinko::play`,
132
- extraArgs: (tx) => [tx.pure.u8(configId)]
133
- });
134
- };
135
- const buildWheelTransaction = (args) => {
136
- const config = require_config.resolveSuigarConfig(args.config);
137
- const configId = (0, _suigar_sdk_utils.toU8)(args.configId);
138
- return buildGenericBetTransaction({
139
- ...args,
140
- config,
141
- game: "wheel",
142
- target: `${config.wheelPackageId}::wheel::play`,
143
- extraArgs: (tx) => [tx.pure.u8(configId)]
144
- });
145
- };
146
- const buildRangeTransaction = (args) => {
147
- const config = require_config.resolveSuigarConfig(args.config);
148
- const scale = args.scale ?? _suigar_sdk_utils.DEFAULT_RANGE_SCALE;
149
- const leftPoint = Math.round(args.leftPoint * scale);
150
- const rightPoint = Math.round(args.rightPoint * scale);
151
- return buildGenericBetTransaction({
152
- ...args,
153
- config,
154
- game: "range",
155
- target: `${config.rangePackageId}::range::play`,
156
- extraArgs: (tx) => [
157
- tx.pure.u64(BigInt(leftPoint)),
158
- tx.pure.u64(BigInt(rightPoint)),
159
- tx.pure.bool(Boolean(args.outOfRange))
160
- ]
161
- });
162
- };
163
- const buildPvpCoinflipCreateTransaction = async (args) => {
164
- const config = require_config.assertRequiredConfig("pvp-coinflip", args.config);
165
- const tx = new _mysten_sui_transactions.Transaction();
166
- const normalizedOwner = normalizeOwner(args.sender ?? args.owner);
167
- const normalizedCoinType = (0, _suigar_currency_registry.normalizeCoinType)(args.coinType);
168
- const resolvedStake = (0, _suigar_sdk_utils.toBigInt)(args.stake);
169
- const encodedMetadata = encodeBetMetadata(resolveBetMetadata(args.metadata, args.partner));
170
- tx.setSenderIfNotSet(normalizedOwner);
171
- const betCoin = await require_coin.resolveBetCoin({
172
- tx,
173
- coinType: normalizedCoinType,
174
- amount: resolvedStake,
175
- suiCoinType: config.suiCoinType,
176
- coinSource: args.coinSource,
177
- client: args.client,
178
- owner: normalizedOwner,
179
- allowGasCoinShortcut: args.allowGasCoinShortcut
180
- });
181
- tx.moveCall({
182
- target: `${config.pvpCoinflipPackageId}::pvp_coinflip::create_game`,
183
- typeArguments: [normalizedCoinType],
184
- arguments: [
185
- tx.object(config.sweethouseId),
186
- betCoin,
187
- tx.pure.bool(args.creatorSide === "tails"),
188
- tx.pure.bool(Boolean(args.isPrivate)),
189
- tx.pure.vector("string", encodedMetadata.keys),
190
- tx.pure.vector("vector<u8>", encodedMetadata.values)
191
- ]
192
- });
193
- applyCommonTransactionDefaults({
194
- transaction: tx,
195
- owner: normalizedOwner,
196
- gasBudget: args.gasBudget,
197
- game: "pvp-coinflip"
198
- });
199
- return tx;
200
- };
201
- const buildPvpCoinflipJoinTransaction = async (args) => {
202
- const config = require_config.assertRequiredConfig("pvp-coinflip", args.config);
203
- const tx = new _mysten_sui_transactions.Transaction();
204
- const normalizedOwner = normalizeOwner(args.sender ?? args.owner);
205
- const normalizedCoinType = (0, _suigar_currency_registry.normalizeCoinType)(args.coinType);
206
- const resolvedStake = (0, _suigar_sdk_utils.toBigInt)(args.stake);
207
- const encodedMetadata = encodeBetMetadata(resolveBetMetadata(args.metadata, args.partner));
208
- const pythPriceInfoObjectId = require_config.resolvePythPriceInfoId(normalizedCoinType, config);
209
- tx.setSenderIfNotSet(normalizedOwner);
210
- const betCoin = await require_coin.resolveBetCoin({
211
- tx,
212
- coinType: normalizedCoinType,
213
- amount: resolvedStake,
214
- suiCoinType: config.suiCoinType,
215
- coinSource: args.coinSource,
216
- client: args.client,
217
- owner: normalizedOwner,
218
- allowGasCoinShortcut: args.allowGasCoinShortcut
219
- });
220
- tx.moveCall({
221
- target: `${config.pvpCoinflipPackageId}::pvp_coinflip::join_game`,
222
- typeArguments: [normalizedCoinType],
223
- arguments: [
224
- tx.pure.id(args.gameId),
225
- tx.object(config.sweethouseId),
226
- betCoin,
227
- tx.pure.vector("string", encodedMetadata.keys),
228
- tx.pure.vector("vector<u8>", encodedMetadata.values),
229
- tx.object(pythPriceInfoObjectId),
230
- tx.object(_mysten_sui_utils.SUI_CLOCK_OBJECT_ID),
231
- tx.object(_mysten_sui_utils.SUI_RANDOM_OBJECT_ID)
232
- ]
233
- });
234
- applyCommonTransactionDefaults({
235
- transaction: tx,
236
- owner: normalizedOwner,
237
- gasBudget: args.gasBudget,
238
- game: "pvp-coinflip"
239
- });
240
- return tx;
241
- };
242
- const buildPvpCoinflipCancelTransaction = (args) => {
243
- const config = require_config.assertRequiredConfig("pvp-coinflip", args.config);
244
- const tx = new _mysten_sui_transactions.Transaction();
245
- const normalizedOwner = normalizeOwner(args.sender ?? args.owner);
246
- tx.setSenderIfNotSet(normalizedOwner);
247
- tx.moveCall({
248
- target: `${config.pvpCoinflipPackageId}::pvp_coinflip::cancel_game`,
249
- typeArguments: [(0, _suigar_currency_registry.normalizeCoinType)(args.coinType)],
250
- arguments: [tx.pure.id(args.gameId), tx.object(config.sweethouseId)]
251
- });
252
- applyCommonTransactionDefaults({
253
- transaction: tx,
254
- owner: normalizedOwner,
255
- gasBudget: args.gasBudget,
256
- game: "pvp-coinflip"
257
- });
258
- return tx;
259
- };
260
- const summarizeTransaction = (transaction, context = {}) => {
261
- const data = transaction.getData();
262
- const commands = (data.commands ?? []).map((command) => {
263
- const kind = String(command.$kind ?? Object.keys(command)[0] ?? "Unknown");
264
- const moveCall = command.MoveCall;
265
- return {
266
- kind,
267
- target: moveCall?.package && moveCall?.module && moveCall?.function ? `${moveCall.package}::${moveCall.module}::${moveCall.function}` : void 0,
268
- typeArguments: moveCall?.typeArguments
269
- };
270
- });
271
- const objectInputs = (data.inputs ?? []).flatMap((input) => input.$kind === "UnresolvedObject" && input.UnresolvedObject?.objectId ? [input.UnresolvedObject.objectId] : []);
272
- return {
273
- sender: data.sender ?? null,
274
- gasBudget: data.gasData?.budget != null ? String(data.gasData.budget) : null,
275
- gasPrice: data.gasData?.price != null ? String(data.gasData.price) : null,
276
- commandCount: commands.length,
277
- commands,
278
- inputs: (data.inputs ?? []).length,
279
- objectInputs,
280
- game: context.game,
281
- coinType: context.coinType ? (0, _suigar_currency_registry.normalizeCoinTypeKey)(context.coinType) : void 0,
282
- stake: context.stake != null ? String((0, _suigar_sdk_utils.toBigInt)(context.stake)) : void 0
283
- };
284
- };
285
- //#endregion
286
- exports.buildCoinflipTransaction = buildCoinflipTransaction;
287
- exports.buildLimboTransaction = buildLimboTransaction;
288
- exports.buildPlinkoTransaction = buildPlinkoTransaction;
289
- exports.buildPvpCoinflipCancelTransaction = buildPvpCoinflipCancelTransaction;
290
- exports.buildPvpCoinflipCreateTransaction = buildPvpCoinflipCreateTransaction;
291
- exports.buildPvpCoinflipJoinTransaction = buildPvpCoinflipJoinTransaction;
292
- exports.buildRangeTransaction = buildRangeTransaction;
293
- exports.buildWheelTransaction = buildWheelTransaction;
294
- exports.summarizeTransaction = summarizeTransaction;
@@ -1,40 +0,0 @@
1
- import { CoinSide, SharedBuildOptions, SupportedGameId, TransactionSummary } from "./types.cjs";
2
- import { Transaction } from "@mysten/sui/transactions";
3
-
4
- //#region src/transactions.d.ts
5
- declare const buildCoinflipTransaction: (args: SharedBuildOptions & {
6
- side: CoinSide;
7
- }) => Promise<Transaction>;
8
- declare const buildLimboTransaction: (args: SharedBuildOptions & {
9
- targetMultiplier: number;
10
- }) => Promise<Transaction>;
11
- declare const buildPlinkoTransaction: (args: SharedBuildOptions & {
12
- configId: number;
13
- }) => Promise<Transaction>;
14
- declare const buildWheelTransaction: (args: SharedBuildOptions & {
15
- configId: number;
16
- }) => Promise<Transaction>;
17
- declare const buildRangeTransaction: (args: SharedBuildOptions & {
18
- leftPoint: number;
19
- rightPoint: number;
20
- outOfRange?: boolean;
21
- scale?: number;
22
- }) => Promise<Transaction>;
23
- declare const buildPvpCoinflipCreateTransaction: (args: SharedBuildOptions & {
24
- creatorSide: CoinSide;
25
- isPrivate?: boolean;
26
- }) => Promise<Transaction>;
27
- declare const buildPvpCoinflipJoinTransaction: (args: SharedBuildOptions & {
28
- gameId: string;
29
- }) => Promise<Transaction>;
30
- declare const buildPvpCoinflipCancelTransaction: (args: Pick<SharedBuildOptions, "config" | "owner" | "sender" | "gasBudget"> & {
31
- gameId: string;
32
- coinType: string;
33
- }) => Transaction;
34
- declare const summarizeTransaction: (transaction: Transaction, context?: {
35
- game?: SupportedGameId;
36
- coinType?: string;
37
- stake?: bigint | number;
38
- }) => TransactionSummary;
39
- //#endregion
40
- export { buildCoinflipTransaction, buildLimboTransaction, buildPlinkoTransaction, buildPvpCoinflipCancelTransaction, buildPvpCoinflipCreateTransaction, buildPvpCoinflipJoinTransaction, buildRangeTransaction, buildWheelTransaction, summarizeTransaction };
@@ -1,40 +0,0 @@
1
- import { CoinSide, SharedBuildOptions, SupportedGameId, TransactionSummary } from "./types.mjs";
2
- import { Transaction } from "@mysten/sui/transactions";
3
-
4
- //#region src/transactions.d.ts
5
- declare const buildCoinflipTransaction: (args: SharedBuildOptions & {
6
- side: CoinSide;
7
- }) => Promise<Transaction>;
8
- declare const buildLimboTransaction: (args: SharedBuildOptions & {
9
- targetMultiplier: number;
10
- }) => Promise<Transaction>;
11
- declare const buildPlinkoTransaction: (args: SharedBuildOptions & {
12
- configId: number;
13
- }) => Promise<Transaction>;
14
- declare const buildWheelTransaction: (args: SharedBuildOptions & {
15
- configId: number;
16
- }) => Promise<Transaction>;
17
- declare const buildRangeTransaction: (args: SharedBuildOptions & {
18
- leftPoint: number;
19
- rightPoint: number;
20
- outOfRange?: boolean;
21
- scale?: number;
22
- }) => Promise<Transaction>;
23
- declare const buildPvpCoinflipCreateTransaction: (args: SharedBuildOptions & {
24
- creatorSide: CoinSide;
25
- isPrivate?: boolean;
26
- }) => Promise<Transaction>;
27
- declare const buildPvpCoinflipJoinTransaction: (args: SharedBuildOptions & {
28
- gameId: string;
29
- }) => Promise<Transaction>;
30
- declare const buildPvpCoinflipCancelTransaction: (args: Pick<SharedBuildOptions, "config" | "owner" | "sender" | "gasBudget"> & {
31
- gameId: string;
32
- coinType: string;
33
- }) => Transaction;
34
- declare const summarizeTransaction: (transaction: Transaction, context?: {
35
- game?: SupportedGameId;
36
- coinType?: string;
37
- stake?: bigint | number;
38
- }) => TransactionSummary;
39
- //#endregion
40
- export { buildCoinflipTransaction, buildLimboTransaction, buildPlinkoTransaction, buildPvpCoinflipCancelTransaction, buildPvpCoinflipCreateTransaction, buildPvpCoinflipJoinTransaction, buildRangeTransaction, buildWheelTransaction, summarizeTransaction };