@suigar/sdk 2.0.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.
@@ -0,0 +1,280 @@
1
+ import { SuiClientTypes, ClientWithCoreApi } from '@mysten/sui/client';
2
+ import { Transaction } from '@mysten/sui/transactions';
3
+ import { BcsType, BcsStruct } from '@mysten/sui/bcs';
4
+
5
+ type BetMetadataPrimitive = string | number | boolean | bigint;
6
+ type BetMetadataValue = BetMetadataPrimitive | Uint8Array | number[];
7
+ type BetMetadataInput = Record<string, BetMetadataValue | null | undefined>;
8
+
9
+ declare const GAMES: readonly ["coinflip", "limbo", "plinko", "pvp-coinflip", "range", "wheel"];
10
+ type Game = (typeof GAMES)[number];
11
+ type StandardGame = Exclude<Game, PvPGame>;
12
+ type PvPGame = 'pvp-coinflip';
13
+ type CoinSide = 'heads' | 'tails';
14
+
15
+ type DeepPartial<T> = T extends object ? {
16
+ [P in keyof T]?: DeepPartial<T[P]>;
17
+ } : T;
18
+
19
+ interface SuigarOptions<Name = 'suigar'> extends DeepPartial<SuigarConfig> {
20
+ name?: Name;
21
+ }
22
+ type SuigarConfig = {
23
+ sweetHousePackageId: string;
24
+ coinTypes: {
25
+ sui: string;
26
+ usdc: string;
27
+ usdcFlowx: string;
28
+ };
29
+ gamesPackageId: Record<Game, string>;
30
+ pyth: SuigarPythConfig;
31
+ };
32
+ type SuigarPythConfig = {
33
+ packageId?: string;
34
+ priceInfoObjectIds: Record<string, string>;
35
+ suiPriceInfoObjectId: string;
36
+ usdcPriceInfoObjectId: string;
37
+ };
38
+
39
+ type SharedBetTransactionOptions = {
40
+ config: SuigarConfig;
41
+ owner: string;
42
+ coinType: string;
43
+ stake: number | bigint;
44
+ cashStake?: number | bigint;
45
+ betCount?: number | bigint;
46
+ metadata?: BetMetadataInput;
47
+ gasBudget?: number | bigint;
48
+ sender?: string;
49
+ allowGasCoinShortcut?: boolean;
50
+ };
51
+
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 = {
73
+ config: SuigarConfig;
74
+ owner: string;
75
+ coinType: string;
76
+ metadata?: BetMetadataInput;
77
+ gasBudget?: number | bigint;
78
+ sender?: string;
79
+ allowGasCoinShortcut?: boolean;
80
+ };
81
+ type BuildCreatePvPCoinflipTransactionOptions = SharedPvPCoinflipTransactionOptions & {
82
+ stake: number | bigint;
83
+ side: CoinSide;
84
+ isPrivate?: boolean;
85
+ };
86
+ type BuildJoinPvPCoinflipTransactionOptions = SharedPvPCoinflipTransactionOptions & {
87
+ gameId: string;
88
+ stake: number | bigint;
89
+ extraObjectId: string;
90
+ };
91
+ type BuildCancelPvPCoinflipTransactionOptions = SharedPvPCoinflipTransactionOptions & {
92
+ gameId: string;
93
+ };
94
+ type BuildPvPCoinflipTransactionOptions<Action extends PvPCoinflipAction = PvPCoinflipAction> = Action extends 'create' ? BuildCreatePvPCoinflipTransactionOptions : Action extends 'join' ? BuildJoinPvPCoinflipTransactionOptions : Action extends 'cancel' ? BuildCancelPvPCoinflipTransactionOptions : never;
95
+
96
+ type BuildGameOptions<GameId extends StandardGame> = GameId extends 'coinflip' ? BuildCoinflipTransactionOptions : GameId extends 'wheel' ? BuildWheelTransactionOptions : GameId extends 'limbo' ? BuildLimboTransactionOptions : GameId extends 'plinko' ? BuildPlinkoTransactionOptions : GameId extends 'range' ? BuildRangeTransactionOptions : never;
97
+
98
+ interface GetOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> extends SuiClientTypes.GetObjectOptions<Include> {
99
+ client: ClientWithCoreApi;
100
+ }
101
+ interface GetManyOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> extends SuiClientTypes.GetObjectsOptions<Include> {
102
+ client: ClientWithCoreApi;
103
+ }
104
+ declare class MoveStruct<T extends Record<string, BcsType<any>>, const Name extends string = string> extends BcsStruct<T, Name> {
105
+ get<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({ objectId, ...options }: GetOptions<Include>): Promise<SuiClientTypes.Object<Include & {
106
+ content: true;
107
+ json: true;
108
+ }> & {
109
+ json: BcsStruct<T>['$inferType'];
110
+ }>;
111
+ getMany<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({ client, ...options }: GetManyOptions<Include>): Promise<Array<SuiClientTypes.Object<Include & {
112
+ content: true;
113
+ json: true;
114
+ }> & {
115
+ json: BcsStruct<T>['$inferType'];
116
+ }>>;
117
+ }
118
+
119
+ /**************************************************************
120
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
121
+ **************************************************************/
122
+
123
+ declare function BetResultEvent<T0 extends BcsType<any>>(...typeParameters: [
124
+ T0
125
+ ]): MoveStruct<{
126
+ player: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
127
+ coin_type: MoveStruct<{
128
+ name: BcsType<string, string, "string">;
129
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
130
+ stake_amount: BcsType<string, string | number | bigint, "u64">;
131
+ unsafe_oracle_usd_coin_price: MoveStruct<{
132
+ is_negative: BcsType<boolean, boolean, "bool">;
133
+ exp: MoveStruct<{
134
+ bits: BcsType<string, string | number | bigint, "u64">;
135
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
136
+ mant: BcsType<string, string | number | bigint, "u64">;
137
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
138
+ adjusted_oracle_usd_coin_price: MoveStruct<{
139
+ is_negative: BcsType<boolean, boolean, "bool">;
140
+ exp: MoveStruct<{
141
+ bits: BcsType<string, string | number | bigint, "u64">;
142
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
143
+ mant: BcsType<string, string | number | bigint, "u64">;
144
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
145
+ outcome_amount: BcsType<string, string | number | bigint, "u64">;
146
+ game_details: MoveStruct<{
147
+ contents: BcsType<{
148
+ key: string;
149
+ value: number[];
150
+ }[], Iterable<{
151
+ key: string;
152
+ value: Iterable<number> & {
153
+ length: number;
154
+ };
155
+ }> & {
156
+ length: number;
157
+ }, string>;
158
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
159
+ metadata: MoveStruct<{
160
+ contents: BcsType<{
161
+ key: string;
162
+ value: number[];
163
+ }[], Iterable<{
164
+ key: string;
165
+ value: Iterable<number> & {
166
+ length: number;
167
+ };
168
+ }> & {
169
+ length: number;
170
+ }, string>;
171
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
172
+ }, `0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::core::BetResultEvent<${T0["name"]}>`>;
173
+
174
+ declare function GameCreatedEvent<T0 extends BcsType<any>>(...typeParameters: [
175
+ T0
176
+ ]): MoveStruct<{
177
+ game_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
178
+ creator: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
179
+ creator_is_tails: BcsType<boolean, boolean, "bool">;
180
+ is_private: BcsType<boolean, boolean, "bool">;
181
+ joiner_is_tails: BcsType<boolean, boolean, "bool">;
182
+ stake_per_player: BcsType<string, string | number | bigint, "u64">;
183
+ house_edge_bps: BcsType<string, string | number | bigint, "u64">;
184
+ coin_type: MoveStruct<{
185
+ name: BcsType<string, string, "string">;
186
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
187
+ }, `0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCreatedEvent<${T0["name"]}>`>;
188
+ declare function GameResolvedEvent<T0 extends BcsType<any>>(...typeParameters: [
189
+ T0
190
+ ]): MoveStruct<{
191
+ game_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
192
+ creator: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
193
+ joiner: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
194
+ winner: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
195
+ creator_is_tails: BcsType<boolean, boolean, "bool">;
196
+ is_private: BcsType<boolean, boolean, "bool">;
197
+ joiner_is_tails: BcsType<boolean, boolean, "bool">;
198
+ stake_per_player: BcsType<string, string | number | bigint, "u64">;
199
+ total_pot: BcsType<string, string | number | bigint, "u64">;
200
+ house_edge_amount: BcsType<string, string | number | bigint, "u64">;
201
+ payout_amount: BcsType<string, string | number | bigint, "u64">;
202
+ coin_type: MoveStruct<{
203
+ name: BcsType<string, string, "string">;
204
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
205
+ }, `0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameResolvedEvent<${T0["name"]}>`>;
206
+ declare function GameCancelledEvent<T0 extends BcsType<any>>(...typeParameters: [
207
+ T0
208
+ ]): MoveStruct<{
209
+ game_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
210
+ creator: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
211
+ creator_is_tails: BcsType<boolean, boolean, "bool">;
212
+ is_private: BcsType<boolean, boolean, "bool">;
213
+ stake_per_player: BcsType<string, string | number | bigint, "u64">;
214
+ coin_type: MoveStruct<{
215
+ name: BcsType<string, string, "string">;
216
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
217
+ }, `0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCancelledEvent<${T0["name"]}>`>;
218
+
219
+ declare function suigar<const Name = 'suigar'>({ name, ...options }?: SuigarOptions<Name>): {
220
+ name: Name;
221
+ register: (client: ClientWithCoreApi) => SuigarClient;
222
+ };
223
+ declare class SuigarClient {
224
+ #private;
225
+ constructor({ client, options, }: {
226
+ client: ClientWithCoreApi;
227
+ options: SuigarOptions;
228
+ });
229
+ /**
230
+ * Builds a transaction with the configured Sui client and returns the BCS bytes as a base64 string.
231
+ *
232
+ * @param transaction Transaction block to serialize.
233
+ * @returns Base64-encoded transaction bytes ready to send over the wire.
234
+ */
235
+ serializeTransactionToBase64(transaction: Transaction): Promise<string>;
236
+ /**
237
+ * BCS struct constructors for decoding Suigar events emitted on-chain.
238
+ */
239
+ bcs: {
240
+ /**
241
+ * Event emitted at the end of a standard game (e.g., Coinflip, Limbo), containing the result and payout information.
242
+ */
243
+ BetResultEvent: typeof BetResultEvent;
244
+ /**
245
+ * Event emitted when a PvP Coinflip game is created, containing the game configuration and initial state.
246
+ */
247
+ PvPCoinflipGameCreated: typeof GameCreatedEvent;
248
+ /**
249
+ * Event emitted when a PvP Coinflip game is resolved, containing the final outcome.
250
+ */
251
+ PvPCoinflipGameResolved: typeof GameResolvedEvent;
252
+ /**
253
+ * Event emitted when a PvP Coinflip game is cancelled.
254
+ */
255
+ PvPCoinflipGameCancelled: typeof GameCancelledEvent;
256
+ };
257
+ /**
258
+ * Transaction builders for Suigar games.
259
+ */
260
+ tx: {
261
+ /**
262
+ * Creates a standard game transaction for the provided game id.
263
+ *
264
+ * @param gameId Supported standard game identifier.
265
+ * @param options Transaction builder options for the selected game.
266
+ * @returns Prepared transaction for the selected game.
267
+ */
268
+ createBetTransaction: <GameId extends StandardGame>(gameId: GameId, options: BuildGameOptions<GameId>) => Transaction;
269
+ /**
270
+ * Creates a PvP coinflip transaction for the requested action.
271
+ *
272
+ * @param action PvP coinflip action to perform.
273
+ * @param options Transaction builder options for the selected action.
274
+ * @returns Prepared PvP coinflip transaction.
275
+ */
276
+ createPvPCoinflipTransaction: <Action extends PvPCoinflipAction>(action: Action, options: BuildPvPCoinflipTransactionOptions<Action>) => Transaction;
277
+ };
278
+ }
279
+
280
+ export { SuigarClient, suigar };
@@ -0,0 +1,280 @@
1
+ import { SuiClientTypes, ClientWithCoreApi } from '@mysten/sui/client';
2
+ import { Transaction } from '@mysten/sui/transactions';
3
+ import { BcsType, BcsStruct } from '@mysten/sui/bcs';
4
+
5
+ type BetMetadataPrimitive = string | number | boolean | bigint;
6
+ type BetMetadataValue = BetMetadataPrimitive | Uint8Array | number[];
7
+ type BetMetadataInput = Record<string, BetMetadataValue | null | undefined>;
8
+
9
+ declare const GAMES: readonly ["coinflip", "limbo", "plinko", "pvp-coinflip", "range", "wheel"];
10
+ type Game = (typeof GAMES)[number];
11
+ type StandardGame = Exclude<Game, PvPGame>;
12
+ type PvPGame = 'pvp-coinflip';
13
+ type CoinSide = 'heads' | 'tails';
14
+
15
+ type DeepPartial<T> = T extends object ? {
16
+ [P in keyof T]?: DeepPartial<T[P]>;
17
+ } : T;
18
+
19
+ interface SuigarOptions<Name = 'suigar'> extends DeepPartial<SuigarConfig> {
20
+ name?: Name;
21
+ }
22
+ type SuigarConfig = {
23
+ sweetHousePackageId: string;
24
+ coinTypes: {
25
+ sui: string;
26
+ usdc: string;
27
+ usdcFlowx: string;
28
+ };
29
+ gamesPackageId: Record<Game, string>;
30
+ pyth: SuigarPythConfig;
31
+ };
32
+ type SuigarPythConfig = {
33
+ packageId?: string;
34
+ priceInfoObjectIds: Record<string, string>;
35
+ suiPriceInfoObjectId: string;
36
+ usdcPriceInfoObjectId: string;
37
+ };
38
+
39
+ type SharedBetTransactionOptions = {
40
+ config: SuigarConfig;
41
+ owner: string;
42
+ coinType: string;
43
+ stake: number | bigint;
44
+ cashStake?: number | bigint;
45
+ betCount?: number | bigint;
46
+ metadata?: BetMetadataInput;
47
+ gasBudget?: number | bigint;
48
+ sender?: string;
49
+ allowGasCoinShortcut?: boolean;
50
+ };
51
+
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 = {
73
+ config: SuigarConfig;
74
+ owner: string;
75
+ coinType: string;
76
+ metadata?: BetMetadataInput;
77
+ gasBudget?: number | bigint;
78
+ sender?: string;
79
+ allowGasCoinShortcut?: boolean;
80
+ };
81
+ type BuildCreatePvPCoinflipTransactionOptions = SharedPvPCoinflipTransactionOptions & {
82
+ stake: number | bigint;
83
+ side: CoinSide;
84
+ isPrivate?: boolean;
85
+ };
86
+ type BuildJoinPvPCoinflipTransactionOptions = SharedPvPCoinflipTransactionOptions & {
87
+ gameId: string;
88
+ stake: number | bigint;
89
+ extraObjectId: string;
90
+ };
91
+ type BuildCancelPvPCoinflipTransactionOptions = SharedPvPCoinflipTransactionOptions & {
92
+ gameId: string;
93
+ };
94
+ type BuildPvPCoinflipTransactionOptions<Action extends PvPCoinflipAction = PvPCoinflipAction> = Action extends 'create' ? BuildCreatePvPCoinflipTransactionOptions : Action extends 'join' ? BuildJoinPvPCoinflipTransactionOptions : Action extends 'cancel' ? BuildCancelPvPCoinflipTransactionOptions : never;
95
+
96
+ type BuildGameOptions<GameId extends StandardGame> = GameId extends 'coinflip' ? BuildCoinflipTransactionOptions : GameId extends 'wheel' ? BuildWheelTransactionOptions : GameId extends 'limbo' ? BuildLimboTransactionOptions : GameId extends 'plinko' ? BuildPlinkoTransactionOptions : GameId extends 'range' ? BuildRangeTransactionOptions : never;
97
+
98
+ interface GetOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> extends SuiClientTypes.GetObjectOptions<Include> {
99
+ client: ClientWithCoreApi;
100
+ }
101
+ interface GetManyOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> extends SuiClientTypes.GetObjectsOptions<Include> {
102
+ client: ClientWithCoreApi;
103
+ }
104
+ declare class MoveStruct<T extends Record<string, BcsType<any>>, const Name extends string = string> extends BcsStruct<T, Name> {
105
+ get<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({ objectId, ...options }: GetOptions<Include>): Promise<SuiClientTypes.Object<Include & {
106
+ content: true;
107
+ json: true;
108
+ }> & {
109
+ json: BcsStruct<T>['$inferType'];
110
+ }>;
111
+ getMany<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({ client, ...options }: GetManyOptions<Include>): Promise<Array<SuiClientTypes.Object<Include & {
112
+ content: true;
113
+ json: true;
114
+ }> & {
115
+ json: BcsStruct<T>['$inferType'];
116
+ }>>;
117
+ }
118
+
119
+ /**************************************************************
120
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
121
+ **************************************************************/
122
+
123
+ declare function BetResultEvent<T0 extends BcsType<any>>(...typeParameters: [
124
+ T0
125
+ ]): MoveStruct<{
126
+ player: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
127
+ coin_type: MoveStruct<{
128
+ name: BcsType<string, string, "string">;
129
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
130
+ stake_amount: BcsType<string, string | number | bigint, "u64">;
131
+ unsafe_oracle_usd_coin_price: MoveStruct<{
132
+ is_negative: BcsType<boolean, boolean, "bool">;
133
+ exp: MoveStruct<{
134
+ bits: BcsType<string, string | number | bigint, "u64">;
135
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
136
+ mant: BcsType<string, string | number | bigint, "u64">;
137
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
138
+ adjusted_oracle_usd_coin_price: MoveStruct<{
139
+ is_negative: BcsType<boolean, boolean, "bool">;
140
+ exp: MoveStruct<{
141
+ bits: BcsType<string, string | number | bigint, "u64">;
142
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
143
+ mant: BcsType<string, string | number | bigint, "u64">;
144
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
145
+ outcome_amount: BcsType<string, string | number | bigint, "u64">;
146
+ game_details: MoveStruct<{
147
+ contents: BcsType<{
148
+ key: string;
149
+ value: number[];
150
+ }[], Iterable<{
151
+ key: string;
152
+ value: Iterable<number> & {
153
+ length: number;
154
+ };
155
+ }> & {
156
+ length: number;
157
+ }, string>;
158
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
159
+ metadata: MoveStruct<{
160
+ contents: BcsType<{
161
+ key: string;
162
+ value: number[];
163
+ }[], Iterable<{
164
+ key: string;
165
+ value: Iterable<number> & {
166
+ length: number;
167
+ };
168
+ }> & {
169
+ length: number;
170
+ }, string>;
171
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
172
+ }, `0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::core::BetResultEvent<${T0["name"]}>`>;
173
+
174
+ declare function GameCreatedEvent<T0 extends BcsType<any>>(...typeParameters: [
175
+ T0
176
+ ]): MoveStruct<{
177
+ game_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
178
+ creator: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
179
+ creator_is_tails: BcsType<boolean, boolean, "bool">;
180
+ is_private: BcsType<boolean, boolean, "bool">;
181
+ joiner_is_tails: BcsType<boolean, boolean, "bool">;
182
+ stake_per_player: BcsType<string, string | number | bigint, "u64">;
183
+ house_edge_bps: BcsType<string, string | number | bigint, "u64">;
184
+ coin_type: MoveStruct<{
185
+ name: BcsType<string, string, "string">;
186
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
187
+ }, `0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCreatedEvent<${T0["name"]}>`>;
188
+ declare function GameResolvedEvent<T0 extends BcsType<any>>(...typeParameters: [
189
+ T0
190
+ ]): MoveStruct<{
191
+ game_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
192
+ creator: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
193
+ joiner: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
194
+ winner: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
195
+ creator_is_tails: BcsType<boolean, boolean, "bool">;
196
+ is_private: BcsType<boolean, boolean, "bool">;
197
+ joiner_is_tails: BcsType<boolean, boolean, "bool">;
198
+ stake_per_player: BcsType<string, string | number | bigint, "u64">;
199
+ total_pot: BcsType<string, string | number | bigint, "u64">;
200
+ house_edge_amount: BcsType<string, string | number | bigint, "u64">;
201
+ payout_amount: BcsType<string, string | number | bigint, "u64">;
202
+ coin_type: MoveStruct<{
203
+ name: BcsType<string, string, "string">;
204
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
205
+ }, `0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameResolvedEvent<${T0["name"]}>`>;
206
+ declare function GameCancelledEvent<T0 extends BcsType<any>>(...typeParameters: [
207
+ T0
208
+ ]): MoveStruct<{
209
+ game_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
210
+ creator: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
211
+ creator_is_tails: BcsType<boolean, boolean, "bool">;
212
+ is_private: BcsType<boolean, boolean, "bool">;
213
+ stake_per_player: BcsType<string, string | number | bigint, "u64">;
214
+ coin_type: MoveStruct<{
215
+ name: BcsType<string, string, "string">;
216
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
217
+ }, `0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCancelledEvent<${T0["name"]}>`>;
218
+
219
+ declare function suigar<const Name = 'suigar'>({ name, ...options }?: SuigarOptions<Name>): {
220
+ name: Name;
221
+ register: (client: ClientWithCoreApi) => SuigarClient;
222
+ };
223
+ declare class SuigarClient {
224
+ #private;
225
+ constructor({ client, options, }: {
226
+ client: ClientWithCoreApi;
227
+ options: SuigarOptions;
228
+ });
229
+ /**
230
+ * Builds a transaction with the configured Sui client and returns the BCS bytes as a base64 string.
231
+ *
232
+ * @param transaction Transaction block to serialize.
233
+ * @returns Base64-encoded transaction bytes ready to send over the wire.
234
+ */
235
+ serializeTransactionToBase64(transaction: Transaction): Promise<string>;
236
+ /**
237
+ * BCS struct constructors for decoding Suigar events emitted on-chain.
238
+ */
239
+ bcs: {
240
+ /**
241
+ * Event emitted at the end of a standard game (e.g., Coinflip, Limbo), containing the result and payout information.
242
+ */
243
+ BetResultEvent: typeof BetResultEvent;
244
+ /**
245
+ * Event emitted when a PvP Coinflip game is created, containing the game configuration and initial state.
246
+ */
247
+ PvPCoinflipGameCreated: typeof GameCreatedEvent;
248
+ /**
249
+ * Event emitted when a PvP Coinflip game is resolved, containing the final outcome.
250
+ */
251
+ PvPCoinflipGameResolved: typeof GameResolvedEvent;
252
+ /**
253
+ * Event emitted when a PvP Coinflip game is cancelled.
254
+ */
255
+ PvPCoinflipGameCancelled: typeof GameCancelledEvent;
256
+ };
257
+ /**
258
+ * Transaction builders for Suigar games.
259
+ */
260
+ tx: {
261
+ /**
262
+ * Creates a standard game transaction for the provided game id.
263
+ *
264
+ * @param gameId Supported standard game identifier.
265
+ * @param options Transaction builder options for the selected game.
266
+ * @returns Prepared transaction for the selected game.
267
+ */
268
+ createBetTransaction: <GameId extends StandardGame>(gameId: GameId, options: BuildGameOptions<GameId>) => Transaction;
269
+ /**
270
+ * Creates a PvP coinflip transaction for the requested action.
271
+ *
272
+ * @param action PvP coinflip action to perform.
273
+ * @param options Transaction builder options for the selected action.
274
+ * @returns Prepared PvP coinflip transaction.
275
+ */
276
+ createPvPCoinflipTransaction: <Action extends PvPCoinflipAction>(action: Action, options: BuildPvPCoinflipTransactionOptions<Action>) => Transaction;
277
+ };
278
+ }
279
+
280
+ export { SuigarClient, suigar };