@suigar/sdk 2.0.0-beta.1 → 2.0.0-beta.10

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