@suigar/sdk 2.0.0-beta.3 → 2.0.0-beta.4

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.
@@ -0,0 +1,310 @@
1
+ import { parseToMist, normalizeSuiAddress } from '@mysten/sui/utils';
2
+ import { bcs, BcsStruct, TypeTagSerializer } from '@mysten/sui/bcs';
3
+ import { isArgument } from '@mysten/sui/transactions';
4
+
5
+ // src/utils/constants.ts
6
+ var DEFAULT_GAS_BUDGET_MIST = parseToMist("0.05");
7
+ var DEFAULT_RANGE_SCALE = 1e6;
8
+ var RANGE_POINT_LIMIT = DEFAULT_RANGE_SCALE * 100;
9
+ var DEFAULT_LIMBO_MULTIPLIER_SCALE = 100;
10
+
11
+ // src/utils/numeric.ts
12
+ function toBigIntAmount(value, fieldName) {
13
+ if (typeof value === "bigint") {
14
+ if (value < 0n) {
15
+ throw new Error(`${fieldName} must be non-negative`);
16
+ }
17
+ return value;
18
+ }
19
+ if (!Number.isFinite(value) || value < 0) {
20
+ throw new Error(`${fieldName} must be a finite non-negative number`);
21
+ }
22
+ return BigInt(Math.trunc(value));
23
+ }
24
+ function toU8Number(value, fieldName) {
25
+ if (!Number.isInteger(value) || value < 0 || value > 255) {
26
+ throw new Error(`${fieldName} must be an integer between 0 and 255`);
27
+ }
28
+ return value;
29
+ }
30
+ var MOVE_STDLIB_ADDRESS = normalizeSuiAddress("0x1");
31
+ var SUI_FRAMEWORK_ADDRESS = normalizeSuiAddress("0x2");
32
+ function getPureBcsSchema(typeTag) {
33
+ const parsedTag = typeof typeTag === "string" ? TypeTagSerializer.parseFromStr(typeTag) : typeTag;
34
+ if ("u8" in parsedTag) {
35
+ return bcs.U8;
36
+ } else if ("u16" in parsedTag) {
37
+ return bcs.U16;
38
+ } else if ("u32" in parsedTag) {
39
+ return bcs.U32;
40
+ } else if ("u64" in parsedTag) {
41
+ return bcs.U64;
42
+ } else if ("u128" in parsedTag) {
43
+ return bcs.U128;
44
+ } else if ("u256" in parsedTag) {
45
+ return bcs.U256;
46
+ } else if ("address" in parsedTag) {
47
+ return bcs.Address;
48
+ } else if ("bool" in parsedTag) {
49
+ return bcs.Bool;
50
+ } else if ("vector" in parsedTag) {
51
+ const type = getPureBcsSchema(parsedTag.vector);
52
+ return type ? bcs.vector(type) : null;
53
+ } else if ("struct" in parsedTag) {
54
+ const structTag = parsedTag.struct;
55
+ const pkg = normalizeSuiAddress(structTag.address);
56
+ if (pkg === MOVE_STDLIB_ADDRESS) {
57
+ if ((structTag.module === "ascii" || structTag.module === "string") && structTag.name === "String") {
58
+ return bcs.String;
59
+ }
60
+ if (structTag.module === "option" && structTag.name === "Option") {
61
+ const type = getPureBcsSchema(structTag.typeParams[0]);
62
+ return type ? bcs.option(type) : null;
63
+ }
64
+ }
65
+ if (pkg === SUI_FRAMEWORK_ADDRESS && structTag.module === "object" && (structTag.name === "ID" || structTag.name === "UID")) {
66
+ return bcs.Address;
67
+ }
68
+ }
69
+ return null;
70
+ }
71
+ function normalizeMoveArguments(args, argTypes, parameterNames) {
72
+ const argLen = Array.isArray(args) ? args.length : Object.keys(args).length;
73
+ if (parameterNames && argLen !== parameterNames.length) {
74
+ throw new Error(
75
+ `Invalid number of arguments, expected ${parameterNames.length}, got ${argLen}`
76
+ );
77
+ }
78
+ const normalizedArgs = [];
79
+ let index = 0;
80
+ for (const [i, argType] of argTypes.entries()) {
81
+ if (argType === "0x2::clock::Clock") {
82
+ normalizedArgs.push((tx) => tx.object.clock());
83
+ continue;
84
+ }
85
+ if (argType === "0x2::random::Random") {
86
+ normalizedArgs.push((tx) => tx.object.random());
87
+ continue;
88
+ }
89
+ if (argType === "0x2::deny_list::DenyList") {
90
+ normalizedArgs.push((tx) => tx.object.denyList());
91
+ continue;
92
+ }
93
+ if (argType === "0x3::sui_system::SuiSystemState") {
94
+ normalizedArgs.push((tx) => tx.object.system());
95
+ continue;
96
+ }
97
+ let arg;
98
+ if (Array.isArray(args)) {
99
+ if (index >= args.length) {
100
+ throw new Error(
101
+ `Invalid number of arguments, expected at least ${index + 1}, got ${args.length}`
102
+ );
103
+ }
104
+ arg = args[index];
105
+ } else {
106
+ if (!parameterNames) {
107
+ throw new Error(`Expected arguments to be passed as an array`);
108
+ }
109
+ const name = parameterNames[index];
110
+ arg = args[name];
111
+ if (arg === void 0) {
112
+ throw new Error(`Parameter ${name} is required`);
113
+ }
114
+ }
115
+ index += 1;
116
+ if (typeof arg === "function" || isArgument(arg)) {
117
+ normalizedArgs.push(arg);
118
+ continue;
119
+ }
120
+ const type = argTypes[i];
121
+ const bcsType = type === null ? null : getPureBcsSchema(type);
122
+ if (bcsType) {
123
+ const bytes = bcsType.serialize(arg);
124
+ normalizedArgs.push((tx) => tx.pure(bytes));
125
+ continue;
126
+ }
127
+ if (typeof arg === "string") {
128
+ normalizedArgs.push((tx) => tx.object(arg));
129
+ continue;
130
+ }
131
+ throw new Error(`Invalid argument ${stringify(arg)} for type ${type}`);
132
+ }
133
+ return normalizedArgs;
134
+ }
135
+ var MoveStruct = class extends BcsStruct {
136
+ async get({
137
+ objectId,
138
+ ...options
139
+ }) {
140
+ const [res] = await this.getMany({
141
+ ...options,
142
+ objectIds: [objectId]
143
+ });
144
+ return res;
145
+ }
146
+ async getMany({
147
+ client,
148
+ ...options
149
+ }) {
150
+ const response = await client.core.getObjects({
151
+ ...options,
152
+ include: {
153
+ ...options.include,
154
+ content: true
155
+ }
156
+ });
157
+ return response.objects.map((obj) => {
158
+ if (obj instanceof Error) {
159
+ throw obj;
160
+ }
161
+ return {
162
+ ...obj,
163
+ json: this.parse(obj.content)
164
+ };
165
+ });
166
+ }
167
+ };
168
+ function stringify(val) {
169
+ if (typeof val === "object") {
170
+ return JSON.stringify(val, (val2) => val2);
171
+ }
172
+ if (typeof val === "bigint") {
173
+ return val.toString();
174
+ }
175
+ return val;
176
+ }
177
+ var $moduleName = "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64";
178
+ var I64 = new MoveStruct({ name: `${$moduleName}::I64`, fields: {
179
+ bits: bcs.u64()
180
+ } });
181
+
182
+ // src/contracts/core/float.ts
183
+ var $moduleName2 = "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float";
184
+ var Float = new MoveStruct({ name: `${$moduleName2}::Float`, fields: {
185
+ is_negative: bcs.bool(),
186
+ exp: I64,
187
+ mant: bcs.u64()
188
+ } });
189
+
190
+ // src/types/game-details.type.ts
191
+ var COINFLIP_GAME_DETAILS_SCHEMA = {
192
+ player_bet: "string",
193
+ coin_outcome: "string"
194
+ };
195
+ var PVP_COINFLIP_GAME_DETAILS_SCHEMA = {
196
+ pvp_result: "string"
197
+ };
198
+ var LIMBO_GAME_DETAILS_SCHEMA = {
199
+ payout_amount: "u64",
200
+ win: "bool",
201
+ roll_multiplier: "float",
202
+ payout_multiplier: "float",
203
+ target_multiplier: "float",
204
+ actual_rtp: "float"
205
+ };
206
+ var RANGE_GAME_DETAILS_SCHEMA = {
207
+ roll_value: "u64",
208
+ win: "bool",
209
+ payout_amount: "u64",
210
+ payout_multiplier: "float",
211
+ left_point: "u64",
212
+ right_point: "u64",
213
+ zone_size: "u64",
214
+ winning_zone_size: "u64",
215
+ is_out_range: "bool",
216
+ bet_threshold: "u64",
217
+ roll_under: "bool",
218
+ range_mode: "u8",
219
+ win_probability: "float",
220
+ win_multiplier: "float",
221
+ actual_rtp: "float"
222
+ };
223
+ var PLINKO_GAME_DETAILS_SCHEMA = {
224
+ slot_index: "u8",
225
+ multiplier: "float",
226
+ payout_amount: "u64",
227
+ plinko_config: "u8"
228
+ };
229
+ var WHEEL_GAME_DETAILS_SCHEMA = {
230
+ case_index: "u8",
231
+ multiplier: "float",
232
+ payout_amount: "u64",
233
+ wheel_config: "u8",
234
+ spin_value: "u64"
235
+ };
236
+ var GAME_DETAILS_SCHEMA = {
237
+ ...COINFLIP_GAME_DETAILS_SCHEMA,
238
+ ...PVP_COINFLIP_GAME_DETAILS_SCHEMA,
239
+ ...LIMBO_GAME_DETAILS_SCHEMA,
240
+ ...RANGE_GAME_DETAILS_SCHEMA,
241
+ ...PLINKO_GAME_DETAILS_SCHEMA,
242
+ ...WHEEL_GAME_DETAILS_SCHEMA
243
+ };
244
+
245
+ // src/utils/parser.ts
246
+ var bcsU8 = bcs.u8();
247
+ var bcsU64 = bcs.u64();
248
+ var bcsBool = bcs.bool();
249
+ var bcsString = bcs.string();
250
+ var textDecoder = new TextDecoder();
251
+ var GAME_DETAIL_BCS = {
252
+ u8: bcsU8,
253
+ u64: bcsU64,
254
+ bool: bcsBool,
255
+ float: Float,
256
+ string: bcsString
257
+ };
258
+ function parseI64(i64) {
259
+ try {
260
+ const value = BigInt(i64.bits ?? 0);
261
+ const maxPositive = 1n << 63n;
262
+ const twoPow64 = 1n << 64n;
263
+ const signed = value >= maxPositive ? value - twoPow64 : value;
264
+ return Number(signed);
265
+ } catch {
266
+ return 0;
267
+ }
268
+ }
269
+ function parseFloat(float) {
270
+ const mantissa = BigInt(float.mant);
271
+ if (mantissa === 0n) {
272
+ return 0;
273
+ }
274
+ const exponent = parseI64(float.exp) - 52;
275
+ const magnitude = Number(mantissa) * Math.pow(2, exponent);
276
+ return float.is_negative ? -magnitude : magnitude;
277
+ }
278
+ function normalizeGameDetailValue(valueType, parsed) {
279
+ if (valueType === "float") {
280
+ return parseFloat(parsed);
281
+ }
282
+ if (valueType === "u64") {
283
+ return Number(parsed);
284
+ }
285
+ return parsed;
286
+ }
287
+ function parseStringGameDetail(value) {
288
+ const bytes = Uint8Array.from(value);
289
+ try {
290
+ return bcsString.parse(bytes);
291
+ } catch {
292
+ return textDecoder.decode(bytes);
293
+ }
294
+ }
295
+ function parseGameDetail(valueType, value) {
296
+ if (valueType === "string") {
297
+ return parseStringGameDetail(value);
298
+ }
299
+ const parsed = GAME_DETAIL_BCS[valueType].parse(Uint8Array.from(value));
300
+ return normalizeGameDetailValue(valueType, parsed);
301
+ }
302
+ function parseGameDetails(gameDetails) {
303
+ return gameDetails.contents.reduce((details, entry) => {
304
+ const valueType = GAME_DETAILS_SCHEMA[entry.key] ?? "string";
305
+ details[entry.key] = parseGameDetail(valueType, entry.value);
306
+ return details;
307
+ }, {});
308
+ }
309
+
310
+ export { DEFAULT_GAS_BUDGET_MIST, DEFAULT_LIMBO_MULTIPLIER_SCALE, DEFAULT_RANGE_SCALE, Float, MoveStruct, RANGE_POINT_LIMIT, normalizeMoveArguments, parseFloat, parseGameDetails, parseI64, toBigIntAmount, toU8Number };
@@ -0,0 +1,84 @@
1
+ declare const GAMES: readonly ["coinflip", "limbo", "plinko", "pvp-coinflip", "range", "wheel"];
2
+ type Game = (typeof GAMES)[number];
3
+ type StandardGame = Exclude<Game, PvPGame>;
4
+ type PvPGame = 'pvp-coinflip';
5
+ type CoinSide = 'heads' | 'tails';
6
+
7
+ type BetMetadataPrimitive = string | number | boolean | bigint;
8
+ type BetMetadataValue = BetMetadataPrimitive | Uint8Array | number[];
9
+ type BetMetadataInput = Record<string, BetMetadataValue | null | undefined>;
10
+
11
+ interface SuigarExtensionOptions<Name = 'suigar'> {
12
+ name?: Name;
13
+ partner?: string;
14
+ }
15
+ type SuigarCoin = 'sui' | 'usdc';
16
+ type SuigarCoinTypes = Record<SuigarCoin, string>;
17
+ type SuigarPackageKey = 'sweetHouse' | 'core' | 'coinflip' | 'limbo' | 'plinko' | 'pvpCoinflip' | 'range' | 'wheel';
18
+ type SuigarPackage = Record<SuigarPackageKey, string>;
19
+ type SuigarPriceInfoObjectId = Record<SuigarCoin, string>;
20
+ type SuigarRegistryKey = 'pvpCoinflip';
21
+ type SuigarRegistryId = Record<SuigarRegistryKey, string>;
22
+ type SuigarConfig = {
23
+ packageIds: SuigarPackage;
24
+ registryIds: SuigarRegistryId;
25
+ coinTypes: SuigarCoinTypes;
26
+ priceInfoObjectIds: SuigarPriceInfoObjectId;
27
+ };
28
+
29
+ type SharedBetTransactionOptions = {
30
+ config: SuigarConfig;
31
+ owner: string;
32
+ coinType: string;
33
+ stake: number | bigint;
34
+ cashStake?: number | bigint;
35
+ betCount?: number | bigint;
36
+ metadata?: BetMetadataInput;
37
+ gasBudget?: number | bigint;
38
+ sender?: string;
39
+ allowGasCoinShortcut?: boolean;
40
+ };
41
+
42
+ type BuildCoinflipTransactionOptions = SharedBetTransactionOptions & {
43
+ side: CoinSide;
44
+ };
45
+ type BuildLimboTransactionOptions = SharedBetTransactionOptions & {
46
+ targetMultiplier: number;
47
+ scale?: number;
48
+ };
49
+ type BuildPlinkoTransactionOptions = SharedBetTransactionOptions & {
50
+ configId: number;
51
+ };
52
+ type BuildRangeTransactionOptions = SharedBetTransactionOptions & {
53
+ leftPoint: number;
54
+ rightPoint: number;
55
+ outOfRange?: boolean;
56
+ scale?: number;
57
+ };
58
+ type BuildWheelTransactionOptions = SharedBetTransactionOptions & {
59
+ configId: number;
60
+ };
61
+ type PvPCoinflipAction = 'create' | 'join' | 'cancel';
62
+ type SharedPvPCoinflipTransactionOptions = {
63
+ config: SuigarConfig;
64
+ owner: string;
65
+ coinType: string;
66
+ metadata?: BetMetadataInput;
67
+ gasBudget?: number | bigint;
68
+ sender?: string;
69
+ allowGasCoinShortcut?: boolean;
70
+ };
71
+ type BuildCreatePvPCoinflipTransactionOptions = SharedPvPCoinflipTransactionOptions & {
72
+ stake: number | bigint;
73
+ side: CoinSide;
74
+ isPrivate?: boolean;
75
+ };
76
+ type BuildJoinPvPCoinflipTransactionOptions = SharedPvPCoinflipTransactionOptions & {
77
+ gameId: string;
78
+ };
79
+ type BuildCancelPvPCoinflipTransactionOptions = SharedPvPCoinflipTransactionOptions & {
80
+ gameId: string;
81
+ };
82
+ type BuildPvPCoinflipTransactionOptions<Action extends PvPCoinflipAction = PvPCoinflipAction> = Action extends 'create' ? BuildCreatePvPCoinflipTransactionOptions : Action extends 'join' ? BuildJoinPvPCoinflipTransactionOptions : Action extends 'cancel' ? BuildCancelPvPCoinflipTransactionOptions : never;
83
+
84
+ export type { BuildCoinflipTransactionOptions as B, CoinSide as C, PvPCoinflipAction as P, StandardGame as S, BuildWheelTransactionOptions as a, BuildLimboTransactionOptions as b, BuildPlinkoTransactionOptions as c, BuildRangeTransactionOptions as d, SuigarConfig as e, BuildPvPCoinflipTransactionOptions as f, SuigarExtensionOptions as g, BuildCancelPvPCoinflipTransactionOptions as h, BuildCreatePvPCoinflipTransactionOptions as i, BuildJoinPvPCoinflipTransactionOptions as j };
@@ -0,0 +1,84 @@
1
+ declare const GAMES: readonly ["coinflip", "limbo", "plinko", "pvp-coinflip", "range", "wheel"];
2
+ type Game = (typeof GAMES)[number];
3
+ type StandardGame = Exclude<Game, PvPGame>;
4
+ type PvPGame = 'pvp-coinflip';
5
+ type CoinSide = 'heads' | 'tails';
6
+
7
+ type BetMetadataPrimitive = string | number | boolean | bigint;
8
+ type BetMetadataValue = BetMetadataPrimitive | Uint8Array | number[];
9
+ type BetMetadataInput = Record<string, BetMetadataValue | null | undefined>;
10
+
11
+ interface SuigarExtensionOptions<Name = 'suigar'> {
12
+ name?: Name;
13
+ partner?: string;
14
+ }
15
+ type SuigarCoin = 'sui' | 'usdc';
16
+ type SuigarCoinTypes = Record<SuigarCoin, string>;
17
+ type SuigarPackageKey = 'sweetHouse' | 'core' | 'coinflip' | 'limbo' | 'plinko' | 'pvpCoinflip' | 'range' | 'wheel';
18
+ type SuigarPackage = Record<SuigarPackageKey, string>;
19
+ type SuigarPriceInfoObjectId = Record<SuigarCoin, string>;
20
+ type SuigarRegistryKey = 'pvpCoinflip';
21
+ type SuigarRegistryId = Record<SuigarRegistryKey, string>;
22
+ type SuigarConfig = {
23
+ packageIds: SuigarPackage;
24
+ registryIds: SuigarRegistryId;
25
+ coinTypes: SuigarCoinTypes;
26
+ priceInfoObjectIds: SuigarPriceInfoObjectId;
27
+ };
28
+
29
+ type SharedBetTransactionOptions = {
30
+ config: SuigarConfig;
31
+ owner: string;
32
+ coinType: string;
33
+ stake: number | bigint;
34
+ cashStake?: number | bigint;
35
+ betCount?: number | bigint;
36
+ metadata?: BetMetadataInput;
37
+ gasBudget?: number | bigint;
38
+ sender?: string;
39
+ allowGasCoinShortcut?: boolean;
40
+ };
41
+
42
+ type BuildCoinflipTransactionOptions = SharedBetTransactionOptions & {
43
+ side: CoinSide;
44
+ };
45
+ type BuildLimboTransactionOptions = SharedBetTransactionOptions & {
46
+ targetMultiplier: number;
47
+ scale?: number;
48
+ };
49
+ type BuildPlinkoTransactionOptions = SharedBetTransactionOptions & {
50
+ configId: number;
51
+ };
52
+ type BuildRangeTransactionOptions = SharedBetTransactionOptions & {
53
+ leftPoint: number;
54
+ rightPoint: number;
55
+ outOfRange?: boolean;
56
+ scale?: number;
57
+ };
58
+ type BuildWheelTransactionOptions = SharedBetTransactionOptions & {
59
+ configId: number;
60
+ };
61
+ type PvPCoinflipAction = 'create' | 'join' | 'cancel';
62
+ type SharedPvPCoinflipTransactionOptions = {
63
+ config: SuigarConfig;
64
+ owner: string;
65
+ coinType: string;
66
+ metadata?: BetMetadataInput;
67
+ gasBudget?: number | bigint;
68
+ sender?: string;
69
+ allowGasCoinShortcut?: boolean;
70
+ };
71
+ type BuildCreatePvPCoinflipTransactionOptions = SharedPvPCoinflipTransactionOptions & {
72
+ stake: number | bigint;
73
+ side: CoinSide;
74
+ isPrivate?: boolean;
75
+ };
76
+ type BuildJoinPvPCoinflipTransactionOptions = SharedPvPCoinflipTransactionOptions & {
77
+ gameId: string;
78
+ };
79
+ type BuildCancelPvPCoinflipTransactionOptions = SharedPvPCoinflipTransactionOptions & {
80
+ gameId: string;
81
+ };
82
+ type BuildPvPCoinflipTransactionOptions<Action extends PvPCoinflipAction = PvPCoinflipAction> = Action extends 'create' ? BuildCreatePvPCoinflipTransactionOptions : Action extends 'join' ? BuildJoinPvPCoinflipTransactionOptions : Action extends 'cancel' ? BuildCancelPvPCoinflipTransactionOptions : never;
83
+
84
+ export type { BuildCoinflipTransactionOptions as B, CoinSide as C, PvPCoinflipAction as P, StandardGame as S, BuildWheelTransactionOptions as a, BuildLimboTransactionOptions as b, BuildPlinkoTransactionOptions as c, BuildRangeTransactionOptions as d, SuigarConfig as e, BuildPvPCoinflipTransactionOptions as f, SuigarExtensionOptions as g, BuildCancelPvPCoinflipTransactionOptions as h, BuildCreatePvPCoinflipTransactionOptions as i, BuildJoinPvPCoinflipTransactionOptions as j };
package/dist/games.cjs ADDED
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1 @@
1
+ export { h as BuildCancelPvPCoinflipTransactionOptions, B as BuildCoinflipTransactionOptions, i as BuildCreatePvPCoinflipTransactionOptions, j as BuildJoinPvPCoinflipTransactionOptions, b as BuildLimboTransactionOptions, c as BuildPlinkoTransactionOptions, d as BuildRangeTransactionOptions, a as BuildWheelTransactionOptions, C as CoinSide, P as PvPCoinflipAction } from './games-nFnPbPuK.cjs';
@@ -0,0 +1 @@
1
+ export { h as BuildCancelPvPCoinflipTransactionOptions, B as BuildCoinflipTransactionOptions, i as BuildCreatePvPCoinflipTransactionOptions, j as BuildJoinPvPCoinflipTransactionOptions, b as BuildLimboTransactionOptions, c as BuildPlinkoTransactionOptions, d as BuildRangeTransactionOptions, a as BuildWheelTransactionOptions, C as CoinSide, P as PvPCoinflipAction } from './games-nFnPbPuK.js';
package/dist/games.js ADDED
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,25 @@
1
+ import { BcsType, BcsStruct } from '@mysten/sui/bcs';
2
+ import { SuiClientTypes, ClientWithCoreApi } from '@mysten/sui/client';
3
+
4
+ interface GetOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> extends SuiClientTypes.GetObjectOptions<Include> {
5
+ client: ClientWithCoreApi;
6
+ }
7
+ interface GetManyOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> extends SuiClientTypes.GetObjectsOptions<Include> {
8
+ client: ClientWithCoreApi;
9
+ }
10
+ declare class MoveStruct<T extends Record<string, BcsType<any>>, const Name extends string = string> extends BcsStruct<T, Name> {
11
+ get<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({ objectId, ...options }: GetOptions<Include>): Promise<SuiClientTypes.Object<Include & {
12
+ content: true;
13
+ json: true;
14
+ }> & {
15
+ json: BcsStruct<T>['$inferType'];
16
+ }>;
17
+ getMany<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({ client, ...options }: GetManyOptions<Include>): Promise<Array<SuiClientTypes.Object<Include & {
18
+ content: true;
19
+ json: true;
20
+ }> & {
21
+ json: BcsStruct<T>['$inferType'];
22
+ }>>;
23
+ }
24
+
25
+ export { MoveStruct as M };
@@ -0,0 +1,25 @@
1
+ import { BcsType, BcsStruct } from '@mysten/sui/bcs';
2
+ import { SuiClientTypes, ClientWithCoreApi } from '@mysten/sui/client';
3
+
4
+ interface GetOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> extends SuiClientTypes.GetObjectOptions<Include> {
5
+ client: ClientWithCoreApi;
6
+ }
7
+ interface GetManyOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> extends SuiClientTypes.GetObjectsOptions<Include> {
8
+ client: ClientWithCoreApi;
9
+ }
10
+ declare class MoveStruct<T extends Record<string, BcsType<any>>, const Name extends string = string> extends BcsStruct<T, Name> {
11
+ get<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({ objectId, ...options }: GetOptions<Include>): Promise<SuiClientTypes.Object<Include & {
12
+ content: true;
13
+ json: true;
14
+ }> & {
15
+ json: BcsStruct<T>['$inferType'];
16
+ }>;
17
+ getMany<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({ client, ...options }: GetManyOptions<Include>): Promise<Array<SuiClientTypes.Object<Include & {
18
+ content: true;
19
+ json: true;
20
+ }> & {
21
+ json: BcsStruct<T>['$inferType'];
22
+ }>>;
23
+ }
24
+
25
+ export { MoveStruct as M };