@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
@@ -1,465 +0,0 @@
1
- import { SuiGraphQLClient } from "@mysten/sui/graphql";
2
- import { SuiGrpcClient } from "@mysten/sui/grpc";
3
-
4
- //#region src/index.d.ts
5
- type NetworkName = 'mainnet' | 'testnet' | 'devnet' | 'localnet' | (string & {});
6
- type SuiNetwork = NetworkName;
7
- type JsonValue = null | boolean | number | string | JsonValue[] | {
8
- [key: string]: JsonValue;
9
- };
10
- type NumericInput = string | number | undefined | null;
11
- type BooleanInput = string | boolean | number | undefined | null;
12
- type ResilientGrpcPoolOptions = {
13
- network?: string;
14
- providerUrl?: string;
15
- extraPublicEndpoints?: string[];
16
- defaultPublicEndpoints?: string[];
17
- requestTimeoutMs?: number;
18
- maxAttempts?: number;
19
- cooldownMs?: number;
20
- maxCooldownMs?: number;
21
- failureThreshold?: number;
22
- retryBackoffMs?: number;
23
- maxRetryRounds?: number;
24
- debug?: boolean;
25
- };
26
- type ResilientGrpcCallOptions<T = unknown> = {
27
- isDeterministicError?: (error: unknown) => boolean;
28
- resolveDeterministicError?: (error: unknown) => T | undefined;
29
- };
30
- type SuiRequestTraceAttempt = {
31
- endpointUrl: string;
32
- startedAt: number;
33
- endedAt: number;
34
- durationMs: number;
35
- success: boolean;
36
- errorMessage?: string | null;
37
- };
38
- type SuiRequestTrace = {
39
- id: string;
40
- method: string;
41
- transport: 'grpc' | 'graphql';
42
- network: SuiNetwork;
43
- startedAt: number;
44
- endedAt: number;
45
- durationMs: number;
46
- success: boolean;
47
- endpointUrl: string | null;
48
- attempts: SuiRequestTraceAttempt[];
49
- params?: JsonValue;
50
- result?: JsonValue;
51
- metadata?: Record<string, JsonValue>;
52
- errorMessage?: string | null;
53
- };
54
- type SuiRequestTraceSink = (trace: SuiRequestTrace) => void;
55
- type ResilientGrpcTuningInput = {
56
- requestTimeoutMs?: NumericInput;
57
- maxAttempts?: NumericInput;
58
- cooldownMs?: NumericInput;
59
- maxCooldownMs?: NumericInput;
60
- failureThreshold?: NumericInput;
61
- retryBackoffMs?: NumericInput;
62
- maxRetryRounds?: NumericInput;
63
- debug?: BooleanInput;
64
- };
65
- type ResilientGrpcTuning = Required<Pick<ResilientGrpcPoolOptions, 'requestTimeoutMs' | 'maxAttempts' | 'cooldownMs' | 'maxCooldownMs' | 'failureThreshold' | 'retryBackoffMs' | 'maxRetryRounds' | 'debug'>>;
66
- type GrpcEndpointsByNetwork = {
67
- mainnet?: string | string[] | undefined | null;
68
- testnet?: string | string[] | undefined | null;
69
- devnet?: string | string[] | undefined | null;
70
- localnet?: string | string[] | undefined | null;
71
- };
72
- declare const setSuiRequestTraceSink: (sink: SuiRequestTraceSink | null) => void;
73
- declare const addSuiRequestTraceSink: (sink: SuiRequestTraceSink) => () => void;
74
- type SuiObjectDataOptions = {
75
- showType?: boolean;
76
- showOwner?: boolean;
77
- showPreviousTransaction?: boolean;
78
- showStorageRebate?: boolean;
79
- showContent?: boolean;
80
- showDisplay?: boolean;
81
- showBcs?: boolean;
82
- };
83
- type SuiParsedData = {
84
- dataType?: string;
85
- type?: string;
86
- fields?: Record<string, unknown>;
87
- hasPublicTransfer?: boolean;
88
- } & Record<string, unknown>;
89
- type SuiMoveObject = {
90
- dataType: 'moveObject';
91
- type?: string;
92
- fields?: Record<string, unknown>;
93
- hasPublicTransfer?: boolean;
94
- } & Record<string, unknown>;
95
- type ObjectOwner = {
96
- AddressOwner: string;
97
- } | {
98
- ObjectOwner: string;
99
- } | {
100
- Shared: {
101
- initial_shared_version?: string;
102
- } | Record<string, unknown>;
103
- } | {
104
- Immutable: true;
105
- } | {
106
- ConsensusAddressOwner: {
107
- owner?: string;
108
- startVersion?: string;
109
- };
110
- } | Record<string, unknown>;
111
- type SuiObjectData = {
112
- objectId?: string;
113
- version?: string;
114
- digest?: string;
115
- type?: string;
116
- owner?: ObjectOwner;
117
- previousTransaction?: string;
118
- storageRebate?: string;
119
- content?: SuiParsedData | null;
120
- bcs?: {
121
- bcsBytes: string;
122
- };
123
- };
124
- type SuiObjectResponse = {
125
- data: SuiObjectData | null;
126
- error?: Record<string, unknown>;
127
- };
128
- type GetObjectParams = {
129
- id: string;
130
- options?: SuiObjectDataOptions | null;
131
- };
132
- type MultiGetObjectsParams = {
133
- ids: string[];
134
- options?: SuiObjectDataOptions | null;
135
- };
136
- type GetOwnedObjectsParams = {
137
- owner: string;
138
- filter?: {
139
- StructType: string;
140
- } | {
141
- MoveModule: {
142
- package: string;
143
- module: string;
144
- };
145
- } | {
146
- MatchAll: unknown[];
147
- } | {
148
- MatchAny: unknown[];
149
- } | {
150
- MatchNone: unknown[];
151
- } | Record<string, unknown> | null;
152
- options?: SuiObjectDataOptions | null;
153
- cursor?: string | null;
154
- limit?: number | null;
155
- };
156
- type PaginatedObjectsResponse = {
157
- data: SuiObjectResponse[];
158
- hasNextPage: boolean;
159
- nextCursor: string | null;
160
- };
161
- type GetCoinsParams = {
162
- owner: string;
163
- coinType?: string | null;
164
- cursor?: string | null;
165
- limit?: number | null;
166
- };
167
- type PaginatedCoins = {
168
- data: Array<{
169
- coinObjectId: string;
170
- version: string;
171
- digest: string;
172
- coinType: string;
173
- balance: string;
174
- previousTransaction: string;
175
- }>;
176
- hasNextPage: boolean;
177
- nextCursor: string | null;
178
- };
179
- type GetBalanceParams = {
180
- owner: string;
181
- coinType?: string | null;
182
- };
183
- type CoinBalance = {
184
- coinType: string;
185
- totalBalance: string;
186
- coinObjectCount: number;
187
- lockedBalance: Record<string, string>;
188
- };
189
- type GetAllBalancesParams = {
190
- owner: string;
191
- };
192
- type DynamicFieldInfo = {
193
- name: {
194
- type?: string;
195
- value?: unknown;
196
- bcsName?: string;
197
- } & Record<string, unknown>;
198
- bcsEncoding: 'base64';
199
- bcsName: string;
200
- type: 'DynamicField' | 'DynamicObject';
201
- objectType: string;
202
- objectId: string;
203
- version: string;
204
- digest: string;
205
- };
206
- type DynamicFieldPage = {
207
- data: DynamicFieldInfo[];
208
- hasNextPage: boolean;
209
- nextCursor: string | null;
210
- };
211
- type GetDynamicFieldsParams = {
212
- parentId: string;
213
- cursor?: string | null;
214
- limit?: number | null;
215
- };
216
- type GetDynamicFieldObjectParams = {
217
- parentId: string;
218
- name: {
219
- type?: string;
220
- value?: unknown;
221
- bcsName?: string;
222
- } & Record<string, unknown>;
223
- };
224
- type PaginatedStrings = {
225
- data: string[];
226
- hasNextPage: boolean;
227
- nextCursor: string | null;
228
- };
229
- type ResolveNameServiceNamesParams = {
230
- address: string;
231
- limit?: number | null;
232
- };
233
- type ResolveNameServiceAddressParams = {
234
- name: string;
235
- };
236
- type EventId = {
237
- txDigest: string;
238
- eventSeq: string;
239
- cursor?: string;
240
- };
241
- type SuiEvent = {
242
- id: EventId;
243
- type: string;
244
- packageId?: string;
245
- transactionModule?: string;
246
- sender?: string;
247
- parsedJson?: Record<string, unknown> | null;
248
- bcs?: string;
249
- timestampMs?: string | null;
250
- };
251
- type SuiEventFilter = {
252
- MoveEventType: string;
253
- } | {
254
- MoveEventModule: {
255
- package: string;
256
- module: string;
257
- };
258
- } | {
259
- Sender: string;
260
- };
261
- type QueryEventsParams = {
262
- query: SuiEventFilter;
263
- cursor?: EventId | null;
264
- limit?: number | null;
265
- order?: 'ascending' | 'descending';
266
- };
267
- type PaginatedEvents = {
268
- data: SuiEvent[];
269
- hasNextPage: boolean;
270
- nextCursor: EventId | null;
271
- };
272
- type SuiObjectChangeCreated = {
273
- type: 'created';
274
- sender?: string;
275
- owner?: ObjectOwner;
276
- objectType?: string;
277
- objectId: string;
278
- version?: string;
279
- digest?: string;
280
- };
281
- type SuiObjectChange = SuiObjectChangeCreated | {
282
- type: 'mutated' | 'deleted' | 'transferred' | 'published' | 'wrapped';
283
- sender?: string;
284
- owner?: ObjectOwner;
285
- objectType?: string;
286
- objectId: string;
287
- version?: string;
288
- digest?: string;
289
- };
290
- type SuiTransactionBlockResponse = {
291
- digest: string;
292
- transaction?: {
293
- data?: Record<string, unknown>;
294
- };
295
- effects?: {
296
- status: {
297
- status: 'success' | 'failure';
298
- error?: string;
299
- };
300
- transactionDigest?: string;
301
- gasUsed?: Record<string, unknown>;
302
- created?: Array<{
303
- owner?: ObjectOwner;
304
- reference?: {
305
- objectId: string;
306
- version?: string;
307
- digest?: string;
308
- };
309
- }>;
310
- mutated?: Array<{
311
- owner?: ObjectOwner;
312
- reference?: {
313
- objectId: string;
314
- version?: string;
315
- digest?: string;
316
- };
317
- }>;
318
- };
319
- events?: SuiEvent[];
320
- balanceChanges?: Array<{
321
- owner: ObjectOwner | null;
322
- coinType: string;
323
- amount: string;
324
- }>;
325
- objectChanges?: SuiObjectChange[];
326
- timestampMs?: string | null;
327
- };
328
- type QueryTransactionBlocksParams = {
329
- filter?: {
330
- FromAddress?: string;
331
- ToAddress?: string;
332
- } | null;
333
- options?: {
334
- showInput?: boolean;
335
- showEffects?: boolean;
336
- showEvents?: boolean;
337
- showBalanceChanges?: boolean;
338
- showObjectChanges?: boolean;
339
- } | null;
340
- cursor?: string | null;
341
- limit?: number | null;
342
- order?: 'ascending' | 'descending';
343
- };
344
- type PaginatedTransactionResponse = {
345
- data: SuiTransactionBlockResponse[];
346
- hasNextPage: boolean;
347
- nextCursor: string | null;
348
- };
349
- type WaitForTransactionParams = {
350
- digest?: string;
351
- result?: unknown;
352
- options?: {
353
- showEffects?: boolean;
354
- showEvents?: boolean;
355
- showBalanceChanges?: boolean;
356
- showObjectChanges?: boolean;
357
- showInput?: boolean;
358
- } | null;
359
- timeout?: number;
360
- };
361
- type SuiCompatClient = {
362
- getObject(params: GetObjectParams): Promise<SuiObjectResponse>;
363
- multiGetObjects(params: MultiGetObjectsParams): Promise<SuiObjectResponse[]>;
364
- getOwnedObjects(params: GetOwnedObjectsParams): Promise<PaginatedObjectsResponse>;
365
- getCoins(params: GetCoinsParams): Promise<PaginatedCoins>;
366
- getBalance(params: GetBalanceParams): Promise<CoinBalance>;
367
- getAllBalances(params: GetAllBalancesParams): Promise<CoinBalance[]>;
368
- getDynamicFields(params: GetDynamicFieldsParams): Promise<DynamicFieldPage>;
369
- getDynamicFieldObject(params: GetDynamicFieldObjectParams): Promise<SuiObjectResponse>;
370
- resolveNameServiceNames(params: ResolveNameServiceNamesParams): Promise<PaginatedStrings>;
371
- resolveNameServiceAddress(params: ResolveNameServiceAddressParams): Promise<string | null>;
372
- getReferenceGasPrice(): Promise<bigint>;
373
- queryEvents(params: QueryEventsParams): Promise<PaginatedEvents>;
374
- queryTransactionBlocks(params: QueryTransactionBlocksParams): Promise<PaginatedTransactionResponse>;
375
- waitForTransaction(params: WaitForTransactionParams): Promise<SuiTransactionBlockResponse>;
376
- };
377
- type BuildSuiCompatClientOptions = {
378
- network: SuiNetwork;
379
- defaultCoinType?: string;
380
- graphqlUrl?: string;
381
- graphqlClient?: SuiGraphQLClient;
382
- grpcPool?: ResilientGrpcPool;
383
- resolveGrpcClient?: (endpointUrl: string) => SuiGrpcClient;
384
- providerGrpcUrl?: string;
385
- };
386
- type GraphQLPageInfo = {
387
- hasNextPage: boolean;
388
- hasPreviousPage: boolean;
389
- startCursor: string | null;
390
- endCursor: string | null;
391
- };
392
- type GraphQLEventNode = {
393
- sequenceNumber: number;
394
- timestamp?: string | null;
395
- sender?: {
396
- address?: string | null;
397
- } | null;
398
- transaction?: {
399
- digest?: string | null;
400
- } | null;
401
- transactionModule?: {
402
- name?: string | null;
403
- package?: {
404
- address?: string | null;
405
- } | null;
406
- } | null;
407
- contents?: {
408
- type?: {
409
- repr?: string | null;
410
- } | null;
411
- json?: Record<string, unknown> | null;
412
- } | null;
413
- };
414
- declare const normalizeNetwork: (value: string | undefined) => NetworkName;
415
- declare const normalizeGrpcUrl: (value: string) => string | null;
416
- declare const parseGrpcList: (value: string | undefined) => string[];
417
- declare const uniqueGrpcUrls: (values: string[]) => string[];
418
- declare const resolveResilientGrpcTuning: (input?: ResilientGrpcTuningInput) => ResilientGrpcTuning;
419
- declare const resolveExtraGrpcEndpoints: (network: string | undefined, endpointsByNetwork?: GrpcEndpointsByNetwork) => string[];
420
- declare class ResilientGrpcPool {
421
- private readonly network;
422
- private readonly providerUrl;
423
- private readonly endpoints;
424
- private readonly maxAttempts;
425
- private readonly failureThreshold;
426
- private readonly cooldownMs;
427
- private readonly maxCooldownMs;
428
- private readonly requestTimeoutMs;
429
- private readonly retryBackoffMs;
430
- private readonly maxRetryRounds;
431
- private readonly debug;
432
- constructor(options: ResilientGrpcPoolOptions);
433
- getProviderUrl(): string;
434
- call<T>(method: string, invoke: (endpointUrl: string) => Promise<T>, options?: ResilientGrpcCallOptions<T>): Promise<T>;
435
- private pickAttemptOrder;
436
- private endpointScore;
437
- private invoke;
438
- private markSuccess;
439
- private markFailure;
440
- }
441
- declare const getOrCreateResilientGrpcPool: (options: ResilientGrpcPoolOptions) => ResilientGrpcPool;
442
- declare const getResilientGrpcPool: (network: string | undefined, providerUrl: string | undefined, options?: Omit<ResilientGrpcPoolOptions, "network" | "providerUrl">) => ResilientGrpcPool;
443
- type ResilientSuiClientRuntimeOptions = ResilientGrpcPoolOptions;
444
- type ResilientSuiCompatClientOptions = Omit<BuildSuiCompatClientOptions, 'network' | 'grpcPool' | 'providerGrpcUrl' | 'resolveGrpcClient'> & {
445
- rawClient?: SuiGrpcClient;
446
- };
447
- declare class ResilientSuiClientRuntime {
448
- readonly network: SuiNetwork;
449
- readonly grpcPool: ResilientGrpcPool;
450
- private readonly grpcClientByUrl;
451
- constructor(options: ResilientSuiClientRuntimeOptions);
452
- getProviderUrl(): string;
453
- getGrpcClient(endpointUrl?: string): SuiGrpcClient;
454
- createCompatClient(options?: ResilientSuiCompatClientOptions): SuiCompatClient;
455
- }
456
- declare const getOrCreateResilientSuiClientRuntime: (options: ResilientSuiClientRuntimeOptions) => ResilientSuiClientRuntime;
457
- declare const getResilientSuiClientRuntime: (network: string | undefined, providerUrl: string | undefined, options?: Omit<ResilientSuiClientRuntimeOptions, "network" | "providerUrl">) => ResilientSuiClientRuntime;
458
- declare const encodeEventCursor: (eventSeq: string, cursor: string) => string;
459
- declare const decodeEventCursor: (cursor: EventId | null | undefined) => string | null;
460
- declare const stripEncodedEventSeq: (value: string) => string;
461
- declare const buildPaginatedEventCursor: (pageInfo: Pick<GraphQLPageInfo, "startCursor" | "endCursor"> | null | undefined, node: Pick<GraphQLEventNode, "sequenceNumber" | "transaction"> | null | undefined, order: "ascending" | "descending") => EventId | null;
462
- declare const toSuiTransactionBlockResponse: (result: any) => SuiTransactionBlockResponse;
463
- declare const buildSuiCompatClient: (grpcClient: SuiGrpcClient, options: BuildSuiCompatClientOptions) => SuiCompatClient;
464
- //#endregion
465
- export { BuildSuiCompatClientOptions, CoinBalance, DynamicFieldInfo, DynamicFieldPage, EventId, GetAllBalancesParams, GetBalanceParams, GetCoinsParams, GetDynamicFieldObjectParams, GetDynamicFieldsParams, GetObjectParams, GetOwnedObjectsParams, GrpcEndpointsByNetwork, MultiGetObjectsParams, NetworkName, ObjectOwner, PaginatedCoins, PaginatedEvents, PaginatedObjectsResponse, PaginatedStrings, PaginatedTransactionResponse, QueryEventsParams, QueryTransactionBlocksParams, ResilientGrpcCallOptions, ResilientGrpcPool, ResilientGrpcPoolOptions, ResilientGrpcTuning, ResilientGrpcTuningInput, ResilientSuiClientRuntime, ResilientSuiClientRuntimeOptions, ResilientSuiCompatClientOptions, ResolveNameServiceAddressParams, ResolveNameServiceNamesParams, SuiCompatClient, SuiEvent, SuiEventFilter, SuiMoveObject, SuiNetwork, SuiObjectChange, SuiObjectChangeCreated, SuiObjectData, SuiObjectDataOptions, SuiObjectResponse, SuiParsedData, SuiRequestTrace, SuiRequestTraceAttempt, SuiRequestTraceSink, SuiTransactionBlockResponse, WaitForTransactionParams, addSuiRequestTraceSink, buildPaginatedEventCursor, buildSuiCompatClient, decodeEventCursor, encodeEventCursor, getOrCreateResilientGrpcPool, getOrCreateResilientSuiClientRuntime, getResilientGrpcPool, getResilientSuiClientRuntime, normalizeGrpcUrl, normalizeNetwork, parseGrpcList, resolveExtraGrpcEndpoints, resolveResilientGrpcTuning, setSuiRequestTraceSink, stripEncodedEventSeq, toSuiTransactionBlockResponse, uniqueGrpcUrls };