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

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.
package/dist/index.d.cts CHANGED
@@ -1,231 +1,230 @@
1
+ import { M as MoveStruct } from './index-3P_LBbDM.cjs';
2
+ import * as _mysten_bcs from '@mysten/bcs';
1
3
  import { SuiClientTypes, ClientWithCoreApi } from '@mysten/sui/client';
2
4
  import { Transaction, BuildTransactionOptions } from '@mysten/sui/transactions';
3
- import { BcsType, BcsStruct } from '@mysten/sui/bcs';
5
+ import { S as StandardGame, B as BuildCoinflipTransactionOptions, a as BuildWheelTransactionOptions, b as BuildLimboTransactionOptions, c as BuildPlinkoTransactionOptions, d as BuildRangeTransactionOptions, G as Game, e as SuigarConfig, W as WithThrowOnError, P as PvPCoinflipAction, f as BuildPvPCoinflipTransactionOptions, g as SuigarExtensionOptions } from './games-BHYRg31e.cjs';
6
+ import '@mysten/sui/bcs';
4
7
 
5
- type BetMetadataPrimitive = string | number | boolean | bigint;
6
- type BetMetadataValue = BetMetadataPrimitive | Uint8Array | number[];
7
- type BetMetadataInput = Record<string, BetMetadataValue | null | undefined>;
8
+ type WithoutConfig<T> = Omit<T, 'config'>;
9
+ type BuildGameOptions<GameId extends StandardGame> = GameId extends 'coinflip' ? WithoutConfig<BuildCoinflipTransactionOptions> : GameId extends 'wheel' ? WithoutConfig<BuildWheelTransactionOptions> : GameId extends 'limbo' ? WithoutConfig<BuildLimboTransactionOptions> : GameId extends 'plinko' ? WithoutConfig<BuildPlinkoTransactionOptions> : GameId extends 'range' ? WithoutConfig<BuildRangeTransactionOptions> : never;
8
10
 
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;
11
+ declare const GAME_SETTINGS: {
12
+ readonly coinflip: {
13
+ readonly settingsKey: MoveStruct<{
14
+ dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
15
+ }, "0xb35c5f286c443752afc8ccb40125a578a4f32df35617170ccfa17fe180ab80ea::coinflip::CoinFlipSettingsKey">;
16
+ readonly parameters: MoveStruct<{
17
+ id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
18
+ house_edge: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
19
+ min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
20
+ max_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
21
+ }, "0xb35c5f286c443752afc8ccb40125a578a4f32df35617170ccfa17fe180ab80ea::coinflip::Parameters<phantom T0>">;
22
+ };
23
+ readonly limbo: {
24
+ readonly settingsKey: MoveStruct<{
25
+ dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
26
+ }, "0x96c7841b9b32c59a219760fd656f1c3aceb53cc74a68ec9844a3a696374309f4::limbo::LimboSettingsKey">;
27
+ readonly parameters: MoveStruct<{
28
+ id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
29
+ min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
30
+ max_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
31
+ max_payout: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
32
+ min_target_multiplier: MoveStruct<{
33
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
34
+ exp: MoveStruct<{
35
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
36
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
37
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
38
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
39
+ max_target_multiplier: MoveStruct<{
40
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
41
+ exp: MoveStruct<{
42
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
43
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
44
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
45
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
46
+ max_number_of_games: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
47
+ min_rtp: MoveStruct<{
48
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
49
+ exp: MoveStruct<{
50
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
51
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
52
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
53
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
54
+ max_rtp: MoveStruct<{
55
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
56
+ exp: MoveStruct<{
57
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
58
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
59
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
60
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
61
+ }, "0x96c7841b9b32c59a219760fd656f1c3aceb53cc74a68ec9844a3a696374309f4::limbo::Parameters<phantom T0>">;
62
+ };
63
+ readonly plinko: {
64
+ readonly settingsKey: MoveStruct<{
65
+ dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
66
+ }, "0xd3dd2200883af10811724f0bed97591ad155a02efd6332d471ff8b346030dfb7::plinko::PlinkoSettingsKey">;
67
+ readonly parameters: MoveStruct<{
68
+ id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
69
+ min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
70
+ max_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
71
+ max_number_of_balls: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
72
+ configs: MoveStruct<{
73
+ contents: _mysten_bcs.BcsType<{
74
+ key: number;
75
+ value: {
76
+ num_rows: number;
77
+ multipliers: {
78
+ is_negative: boolean;
79
+ exp: {
80
+ bits: string;
81
+ };
82
+ mant: string;
83
+ }[];
84
+ min_stake: string;
85
+ max_stake: string;
86
+ is_playable: boolean;
87
+ };
88
+ }[], Iterable<{
89
+ key: number;
90
+ value: {
91
+ num_rows: number;
92
+ multipliers: Iterable<{
93
+ is_negative: boolean;
94
+ exp: {
95
+ bits: string | number | bigint;
96
+ };
97
+ mant: string | number | bigint;
98
+ }> & {
99
+ length: number;
100
+ };
101
+ min_stake: string | number | bigint;
102
+ max_stake: string | number | bigint;
103
+ is_playable: boolean;
104
+ };
105
+ }> & {
106
+ length: number;
107
+ }, string>;
108
+ }, "0x2::vec_map::VecMap<u8, 0xd3dd2200883af10811724f0bed97591ad155a02efd6332d471ff8b346030dfb7::plinko::PlinkoConfig>">;
109
+ }, "0xd3dd2200883af10811724f0bed97591ad155a02efd6332d471ff8b346030dfb7::plinko::Parameters<phantom T0>">;
110
+ };
111
+ readonly 'pvp-coinflip': {
112
+ readonly settingsKey: MoveStruct<{
113
+ dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
114
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::PvpCoinflipSettingsKey">;
115
+ readonly parameters: MoveStruct<{
116
+ id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
117
+ house_edge_bps: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
118
+ min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
119
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::Parameters<phantom T0>">;
120
+ };
121
+ readonly range: {
122
+ readonly settingsKey: MoveStruct<{
123
+ dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
124
+ }, "0x096a4cf18b3661e76b2c62b90785418345d52f45b272448794f123a4cb6b6416::range::RangeSettingsKey">;
125
+ readonly parameters: MoveStruct<{
126
+ id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
127
+ min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
128
+ max_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
129
+ min_zone_size: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
130
+ max_zone_size: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
131
+ max_number_of_games: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
132
+ min_rtp: MoveStruct<{
133
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
134
+ exp: MoveStruct<{
135
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
136
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
137
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
138
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
139
+ max_rtp: MoveStruct<{
140
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
141
+ exp: MoveStruct<{
142
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
143
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
144
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
145
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
146
+ }, "0x096a4cf18b3661e76b2c62b90785418345d52f45b272448794f123a4cb6b6416::range::Parameters<phantom T0>">;
147
+ };
148
+ readonly wheel: {
149
+ readonly settingsKey: MoveStruct<{
150
+ dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
151
+ }, "0x0997852ded7e13301c42317004bc49704a893aa82997c5706cebee59053a31b7::wheel::WheelSettingsKey">;
152
+ readonly parameters: MoveStruct<{
153
+ id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
154
+ min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
155
+ max_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
156
+ max_number_of_spins: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
157
+ configs: MoveStruct<{
158
+ contents: _mysten_bcs.BcsType<{
159
+ key: number;
160
+ value: {
161
+ num_cases: number;
162
+ multipliers: {
163
+ is_negative: boolean;
164
+ exp: {
165
+ bits: string;
166
+ };
167
+ mant: string;
168
+ }[];
169
+ min_stake: string;
170
+ max_stake: string;
171
+ is_playable: boolean;
172
+ };
173
+ }[], Iterable<{
174
+ key: number;
175
+ value: {
176
+ num_cases: number;
177
+ multipliers: Iterable<{
178
+ is_negative: boolean;
179
+ exp: {
180
+ bits: string | number | bigint;
181
+ };
182
+ mant: string | number | bigint;
183
+ }> & {
184
+ length: number;
185
+ };
186
+ min_stake: string | number | bigint;
187
+ max_stake: string | number | bigint;
188
+ is_playable: boolean;
189
+ };
190
+ }> & {
191
+ length: number;
192
+ }, string>;
193
+ }, "0x2::vec_map::VecMap<u8, 0x0997852ded7e13301c42317004bc49704a893aa82997c5706cebee59053a31b7::wheel::WheelConfig>">;
194
+ }, "0x0997852ded7e13301c42317004bc49704a893aa82997c5706cebee59053a31b7::wheel::Parameters<phantom T0>">;
28
195
  };
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
196
  };
86
- type BuildJoinPvPCoinflipTransactionOptions = SharedPvPCoinflipTransactionOptions & {
87
- gameId: string;
88
- stake: number | bigint;
89
- extraObjectId: string;
197
+ type GameParametersMap = {
198
+ [TGame in Game]: ReturnType<(typeof GAME_SETTINGS)[TGame]['parameters']['parse']>;
90
199
  };
91
- type BuildCancelPvPCoinflipTransactionOptions = SharedPvPCoinflipTransactionOptions & {
92
- gameId: string;
200
+ type GameParameters<TGame extends Game> = GameParametersMap[TGame];
201
+ type GetGameParametersOptions = SuiClientTypes.CoreClientMethodOptions & {
202
+ coinType?: string;
203
+ ignoreCache?: boolean;
93
204
  };
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
205
 
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>): {
206
+ declare function suigar<const Name = 'suigar'>({ name, partner, cacheTtl, }?: SuigarExtensionOptions<Name>): {
220
207
  name: Name;
221
208
  register: (client: ClientWithCoreApi) => SuigarClient;
222
209
  };
223
210
  declare class SuigarClient {
224
211
  #private;
225
- constructor({ client, options, }: {
212
+ constructor({ client, name, partner, cacheTtl, }: {
226
213
  client: ClientWithCoreApi;
227
- options: SuigarOptions;
214
+ name: string;
215
+ partner?: string;
216
+ cacheTtl?: number;
228
217
  });
218
+ /**
219
+ * Returns the resolved SDK configuration for the connected network.
220
+ *
221
+ * This is primarily useful for debugging or inspecting which package ids,
222
+ * registry ids, supported coin types, and price info object ids the SDK
223
+ * resolved for the current client network.
224
+ *
225
+ * @returns Network-resolved Suigar configuration.
226
+ */
227
+ getConfig(): SuigarConfig;
229
228
  /**
230
229
  * Builds a transaction with the configured Sui client and encodes the resulting BCS bytes as base64.
231
230
  *
@@ -239,25 +238,198 @@ declare class SuigarClient {
239
238
  */
240
239
  serializeTransactionToBase64(transaction: Transaction, options?: Omit<BuildTransactionOptions, 'client'>): Promise<string>;
241
240
  /**
242
- * BCS struct constructors for decoding Suigar events emitted on-chain.
241
+ * Reads on-chain game parameters for the requested game.
242
+ *
243
+ * The SDK first reads the selected game's settings object from SweetHouse,
244
+ * then reads that game's coin-specific `Parameters<T>` object. Results are
245
+ * cached according to the extension `cacheTtl` option. Pass
246
+ * `ignoreCache: true` to refresh the onchain read and replace the cached
247
+ * value.
248
+ *
249
+ * @param game Game whose parameters should be loaded.
250
+ * @param options Optional coin type, cache override, and abort signal.
251
+ * @returns Parsed game parameters typed for the requested game.
252
+ */
253
+ getGameParameters<TGame extends Game>(game: TGame, options?: GetGameParametersOptions): Promise<GameParameters<TGame>>;
254
+ /**
255
+ * Lists unresolved PvP coinflip games from the configured registry and resolves
256
+ * each entry into parsed onchain game state.
257
+ *
258
+ * This fetches dynamic fields from the PvP coinflip registry object, then bulk
259
+ * loads the referenced game objects through `client.core.getObjects()`. Registry
260
+ * membership is the unresolved-state signal: when a game is joined and resolved,
261
+ * the Move flow removes it from the registry and deletes the live `Game` object.
262
+ * Use this when a product needs the current set of open PvP coinflip matches for
263
+ * browsing or lobby views.
264
+ *
265
+ * @param options Optional dynamic field pagination forwarded to `listDynamicFields()`, excluding `parentId`.
266
+ * Supported options such as `limit`, `cursor`, and `signal` are forwarded to the
267
+ * underlying lookup calls. Pass `throwOnError: true` to fail the whole lookup
268
+ * when any referenced game object cannot be fetched or parsed. By default,
269
+ * failed per-object lookups are skipped and only successfully parsed unresolved
270
+ * games are returned.
271
+ * @returns Parsed unresolved PvP coinflip game objects for the requested
272
+ * registry page. When `throwOnError` is `false`, entries that fail object fetch
273
+ * or parse are omitted from the returned array.
274
+ */
275
+ getPvPCoinflipGames(options?: WithThrowOnError<Omit<SuiClientTypes.ListDynamicFieldsOptions, 'parentId'>>): Promise<{
276
+ coinType: string;
277
+ id: string;
278
+ creator: string;
279
+ creator_is_tails: boolean;
280
+ is_private: boolean;
281
+ creator_metadata: {
282
+ contents: {
283
+ key: string;
284
+ value: number[];
285
+ }[];
286
+ };
287
+ joiner: string;
288
+ winner: string;
289
+ stake_per_player: string;
290
+ house_edge_bps: string;
291
+ stake_pot: {
292
+ value: string;
293
+ };
294
+ }[]>;
295
+ /**
296
+ * BCS struct constructors for decoding on-chain objects and events related to Suigar games.
297
+ *
298
+ * These can be used to parse the `content` field of on-chain objects and events into structured data with the
299
+ * expected types. For example, use `client.suigar.bcs.PvPCoinflipGame.parse(object.content)` to decode a PvP
300
+ * coinflip game object.
301
+ *
302
+ * Note that these constructors are not meant for encoding transaction arguments, as the SDK's transaction
303
+ * builders handle argument serialization internally. Use these primarily for decoding and parsing on-chain data.
243
304
  */
244
305
  bcs: {
306
+ /**
307
+ * Object representing the state of a PvP coinflip game, as stored on-chain.
308
+ */
309
+ PvPCoinflipGame: MoveStruct<{
310
+ id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
311
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
312
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
313
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
314
+ creator_metadata: MoveStruct<{
315
+ contents: _mysten_bcs.BcsType<{
316
+ key: string;
317
+ value: number[];
318
+ }[], Iterable<{
319
+ key: string;
320
+ value: Iterable<number> & {
321
+ length: number;
322
+ };
323
+ }> & {
324
+ length: number;
325
+ }, string>;
326
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
327
+ joiner: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
328
+ winner: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
329
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
330
+ house_edge_bps: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
331
+ stake_pot: MoveStruct<{
332
+ value: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
333
+ }, "0x2::balance::Balance<phantom T0>">;
334
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::Game<phantom T0>">;
245
335
  /**
246
336
  * Event emitted at the end of a standard game (e.g., Coinflip, Limbo), containing the result and payout information.
247
337
  */
248
- BetResultEvent: typeof BetResultEvent;
338
+ BetResultEvent: MoveStruct<{
339
+ player: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
340
+ coin_type: MoveStruct<{
341
+ name: _mysten_bcs.BcsType<string, string, "string">;
342
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
343
+ stake_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
344
+ unsafe_oracle_usd_coin_price: MoveStruct<{
345
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
346
+ exp: MoveStruct<{
347
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
348
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
349
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
350
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
351
+ adjusted_oracle_usd_coin_price: MoveStruct<{
352
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
353
+ exp: MoveStruct<{
354
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
355
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
356
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
357
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
358
+ outcome_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
359
+ game_details: MoveStruct<{
360
+ contents: _mysten_bcs.BcsType<{
361
+ key: string;
362
+ value: number[];
363
+ }[], Iterable<{
364
+ key: string;
365
+ value: Iterable<number> & {
366
+ length: number;
367
+ };
368
+ }> & {
369
+ length: number;
370
+ }, string>;
371
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
372
+ metadata: MoveStruct<{
373
+ contents: _mysten_bcs.BcsType<{
374
+ key: string;
375
+ value: number[];
376
+ }[], Iterable<{
377
+ key: string;
378
+ value: Iterable<number> & {
379
+ length: number;
380
+ };
381
+ }> & {
382
+ length: number;
383
+ }, string>;
384
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
385
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::core::BetResultEvent<phantom T0>">;
249
386
  /**
250
387
  * Event emitted when a PvP Coinflip game is created, containing the game configuration and initial state.
251
388
  */
252
- PvPCoinflipGameCreated: typeof GameCreatedEvent;
389
+ PvPCoinflipGameCreatedEvent: MoveStruct<{
390
+ game_id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
391
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
392
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
393
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
394
+ joiner_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
395
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
396
+ house_edge_bps: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
397
+ coin_type: MoveStruct<{
398
+ name: _mysten_bcs.BcsType<string, string, "string">;
399
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
400
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCreatedEvent<phantom T0>">;
253
401
  /**
254
402
  * Event emitted when a PvP Coinflip game is resolved, containing the final outcome.
255
403
  */
256
- PvPCoinflipGameResolved: typeof GameResolvedEvent;
404
+ PvPCoinflipGameResolvedEvent: MoveStruct<{
405
+ game_id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
406
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
407
+ joiner: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
408
+ winner: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
409
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
410
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
411
+ joiner_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
412
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
413
+ total_pot: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
414
+ house_edge_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
415
+ payout_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
416
+ coin_type: MoveStruct<{
417
+ name: _mysten_bcs.BcsType<string, string, "string">;
418
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
419
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameResolvedEvent<phantom T0>">;
257
420
  /**
258
421
  * Event emitted when a PvP Coinflip game is cancelled.
259
422
  */
260
- PvPCoinflipGameCancelled: typeof GameCancelledEvent;
423
+ PvPCoinflipGameCancelledEvent: MoveStruct<{
424
+ game_id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
425
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
426
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
427
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
428
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
429
+ coin_type: MoveStruct<{
430
+ name: _mysten_bcs.BcsType<string, string, "string">;
431
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
432
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCancelledEvent<phantom T0>">;
261
433
  };
262
434
  /**
263
435
  * Transaction builders for Suigar games.
@@ -282,4 +454,4 @@ declare class SuigarClient {
282
454
  };
283
455
  }
284
456
 
285
- export { suigar };
457
+ export { SuigarClient, suigar };