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

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,6 +1,28 @@
1
+ import { BcsType, BcsStruct } from '@mysten/sui/bcs';
1
2
  import { SuiClientTypes, ClientWithCoreApi } from '@mysten/sui/client';
3
+ import * as _mysten_bcs from '@mysten/bcs';
2
4
  import { Transaction, BuildTransactionOptions } from '@mysten/sui/transactions';
3
- import { BcsType, BcsStruct } from '@mysten/sui/bcs';
5
+
6
+ interface GetOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> extends SuiClientTypes.GetObjectOptions<Include> {
7
+ client: ClientWithCoreApi;
8
+ }
9
+ interface GetManyOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> extends SuiClientTypes.GetObjectsOptions<Include> {
10
+ client: ClientWithCoreApi;
11
+ }
12
+ declare class MoveStruct<T extends Record<string, BcsType<any>>, const Name extends string = string> extends BcsStruct<T, Name> {
13
+ get<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({ objectId, ...options }: GetOptions<Include>): Promise<SuiClientTypes.Object<Include & {
14
+ content: true;
15
+ json: true;
16
+ }> & {
17
+ json: BcsStruct<T>['$inferType'];
18
+ }>;
19
+ getMany<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({ client, ...options }: GetManyOptions<Include>): Promise<Array<SuiClientTypes.Object<Include & {
20
+ content: true;
21
+ json: true;
22
+ }> & {
23
+ json: BcsStruct<T>['$inferType'];
24
+ }>>;
25
+ }
4
26
 
5
27
  type BetMetadataPrimitive = string | number | boolean | bigint;
6
28
  type BetMetadataValue = BetMetadataPrimitive | Uint8Array | number[];
@@ -12,28 +34,18 @@ type StandardGame = Exclude<Game, PvPGame>;
12
34
  type PvPGame = 'pvp-coinflip';
13
35
  type CoinSide = 'heads' | 'tails';
14
36
 
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> {
37
+ interface SuigarExtensionOptions<Name = 'suigar'> {
20
38
  name?: Name;
21
39
  }
40
+ type SuigarCoin = 'sui' | 'usdc';
41
+ type SuigarCoinTypes = Record<SuigarCoin, string>;
42
+ type SuigarPackageKey = 'sweetHouse' | 'core' | 'coinflip' | 'limbo' | 'plinko' | 'pvpCoinflip' | 'range' | 'wheel';
43
+ type SuigarPackage = Record<SuigarPackageKey, string>;
44
+ type SuigarPriceInfoObjectId = Record<SuigarCoin, string>;
22
45
  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;
46
+ packageIds: SuigarPackage;
47
+ coinTypes: SuigarCoinTypes;
48
+ priceInfoObjectIds: SuigarPriceInfoObjectId;
37
49
  };
38
50
 
39
51
  type SharedBetTransactionOptions = {
@@ -93,139 +105,28 @@ type BuildCancelPvPCoinflipTransactionOptions = SharedPvPCoinflipTransactionOpti
93
105
  };
94
106
  type BuildPvPCoinflipTransactionOptions<Action extends PvPCoinflipAction = PvPCoinflipAction> = Action extends 'create' ? BuildCreatePvPCoinflipTransactionOptions : Action extends 'join' ? BuildJoinPvPCoinflipTransactionOptions : Action extends 'cancel' ? BuildCancelPvPCoinflipTransactionOptions : never;
95
107
 
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
- **************************************************************/
108
+ type WithoutConfig<T> = Omit<T, 'config'>;
109
+ 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;
122
110
 
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>): {
111
+ declare function suigar<const Name = 'suigar'>({ name, }?: SuigarExtensionOptions<Name>): {
220
112
  name: Name;
221
113
  register: (client: ClientWithCoreApi) => SuigarClient;
222
114
  };
223
115
  declare class SuigarClient {
224
116
  #private;
225
- constructor({ client, options, }: {
117
+ constructor({ client }: {
226
118
  client: ClientWithCoreApi;
227
- options: SuigarOptions;
228
119
  });
120
+ /**
121
+ * Returns the resolved SDK configuration for the connected network.
122
+ *
123
+ * This is primarily useful for debugging or inspecting which package ids,
124
+ * supported coin types, and price info object ids the SDK resolved for the
125
+ * current client network.
126
+ *
127
+ * @returns Network-resolved Suigar configuration.
128
+ */
129
+ getConfig(): SuigarConfig;
229
130
  /**
230
131
  * Builds a transaction with the configured Sui client and encodes the resulting BCS bytes as base64.
231
132
  *
@@ -245,19 +146,101 @@ declare class SuigarClient {
245
146
  /**
246
147
  * Event emitted at the end of a standard game (e.g., Coinflip, Limbo), containing the result and payout information.
247
148
  */
248
- BetResultEvent: typeof BetResultEvent;
149
+ BetResultEvent: MoveStruct<{
150
+ player: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
151
+ coin_type: MoveStruct<{
152
+ name: _mysten_bcs.BcsType<string, string, "string">;
153
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
154
+ stake_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
155
+ unsafe_oracle_usd_coin_price: MoveStruct<{
156
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
157
+ exp: MoveStruct<{
158
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
159
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
160
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
161
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
162
+ adjusted_oracle_usd_coin_price: MoveStruct<{
163
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
164
+ exp: MoveStruct<{
165
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
166
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
167
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
168
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
169
+ outcome_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
170
+ game_details: MoveStruct<{
171
+ contents: _mysten_bcs.BcsType<{
172
+ key: string;
173
+ value: number[];
174
+ }[], Iterable<{
175
+ key: string;
176
+ value: Iterable<number> & {
177
+ length: number;
178
+ };
179
+ }> & {
180
+ length: number;
181
+ }, string>;
182
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
183
+ metadata: MoveStruct<{
184
+ contents: _mysten_bcs.BcsType<{
185
+ key: string;
186
+ value: number[];
187
+ }[], Iterable<{
188
+ key: string;
189
+ value: Iterable<number> & {
190
+ length: number;
191
+ };
192
+ }> & {
193
+ length: number;
194
+ }, string>;
195
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
196
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::core::BetResultEvent<phantom T0>">;
249
197
  /**
250
198
  * Event emitted when a PvP Coinflip game is created, containing the game configuration and initial state.
251
199
  */
252
- PvPCoinflipGameCreated: typeof GameCreatedEvent;
200
+ PvPCoinflipGameCreated: MoveStruct<{
201
+ game_id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
202
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
203
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
204
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
205
+ joiner_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
206
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
207
+ house_edge_bps: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
208
+ coin_type: MoveStruct<{
209
+ name: _mysten_bcs.BcsType<string, string, "string">;
210
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
211
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCreatedEvent<phantom T0>">;
253
212
  /**
254
213
  * Event emitted when a PvP Coinflip game is resolved, containing the final outcome.
255
214
  */
256
- PvPCoinflipGameResolved: typeof GameResolvedEvent;
215
+ PvPCoinflipGameResolved: MoveStruct<{
216
+ game_id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
217
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
218
+ joiner: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
219
+ winner: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
220
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
221
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
222
+ joiner_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
223
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
224
+ total_pot: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
225
+ house_edge_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
226
+ payout_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
227
+ coin_type: MoveStruct<{
228
+ name: _mysten_bcs.BcsType<string, string, "string">;
229
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
230
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameResolvedEvent<phantom T0>">;
257
231
  /**
258
232
  * Event emitted when a PvP Coinflip game is cancelled.
259
233
  */
260
- PvPCoinflipGameCancelled: typeof GameCancelledEvent;
234
+ PvPCoinflipGameCancelled: MoveStruct<{
235
+ game_id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
236
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
237
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
238
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
239
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
240
+ coin_type: MoveStruct<{
241
+ name: _mysten_bcs.BcsType<string, string, "string">;
242
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
243
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCancelledEvent<phantom T0>">;
261
244
  };
262
245
  /**
263
246
  * Transaction builders for Suigar games.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,28 @@
1
+ import { BcsType, BcsStruct } from '@mysten/sui/bcs';
1
2
  import { SuiClientTypes, ClientWithCoreApi } from '@mysten/sui/client';
3
+ import * as _mysten_bcs from '@mysten/bcs';
2
4
  import { Transaction, BuildTransactionOptions } from '@mysten/sui/transactions';
3
- import { BcsType, BcsStruct } from '@mysten/sui/bcs';
5
+
6
+ interface GetOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> extends SuiClientTypes.GetObjectOptions<Include> {
7
+ client: ClientWithCoreApi;
8
+ }
9
+ interface GetManyOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> extends SuiClientTypes.GetObjectsOptions<Include> {
10
+ client: ClientWithCoreApi;
11
+ }
12
+ declare class MoveStruct<T extends Record<string, BcsType<any>>, const Name extends string = string> extends BcsStruct<T, Name> {
13
+ get<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({ objectId, ...options }: GetOptions<Include>): Promise<SuiClientTypes.Object<Include & {
14
+ content: true;
15
+ json: true;
16
+ }> & {
17
+ json: BcsStruct<T>['$inferType'];
18
+ }>;
19
+ getMany<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({ client, ...options }: GetManyOptions<Include>): Promise<Array<SuiClientTypes.Object<Include & {
20
+ content: true;
21
+ json: true;
22
+ }> & {
23
+ json: BcsStruct<T>['$inferType'];
24
+ }>>;
25
+ }
4
26
 
5
27
  type BetMetadataPrimitive = string | number | boolean | bigint;
6
28
  type BetMetadataValue = BetMetadataPrimitive | Uint8Array | number[];
@@ -12,28 +34,18 @@ type StandardGame = Exclude<Game, PvPGame>;
12
34
  type PvPGame = 'pvp-coinflip';
13
35
  type CoinSide = 'heads' | 'tails';
14
36
 
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> {
37
+ interface SuigarExtensionOptions<Name = 'suigar'> {
20
38
  name?: Name;
21
39
  }
40
+ type SuigarCoin = 'sui' | 'usdc';
41
+ type SuigarCoinTypes = Record<SuigarCoin, string>;
42
+ type SuigarPackageKey = 'sweetHouse' | 'core' | 'coinflip' | 'limbo' | 'plinko' | 'pvpCoinflip' | 'range' | 'wheel';
43
+ type SuigarPackage = Record<SuigarPackageKey, string>;
44
+ type SuigarPriceInfoObjectId = Record<SuigarCoin, string>;
22
45
  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;
46
+ packageIds: SuigarPackage;
47
+ coinTypes: SuigarCoinTypes;
48
+ priceInfoObjectIds: SuigarPriceInfoObjectId;
37
49
  };
38
50
 
39
51
  type SharedBetTransactionOptions = {
@@ -93,139 +105,28 @@ type BuildCancelPvPCoinflipTransactionOptions = SharedPvPCoinflipTransactionOpti
93
105
  };
94
106
  type BuildPvPCoinflipTransactionOptions<Action extends PvPCoinflipAction = PvPCoinflipAction> = Action extends 'create' ? BuildCreatePvPCoinflipTransactionOptions : Action extends 'join' ? BuildJoinPvPCoinflipTransactionOptions : Action extends 'cancel' ? BuildCancelPvPCoinflipTransactionOptions : never;
95
107
 
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
- **************************************************************/
108
+ type WithoutConfig<T> = Omit<T, 'config'>;
109
+ 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;
122
110
 
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>): {
111
+ declare function suigar<const Name = 'suigar'>({ name, }?: SuigarExtensionOptions<Name>): {
220
112
  name: Name;
221
113
  register: (client: ClientWithCoreApi) => SuigarClient;
222
114
  };
223
115
  declare class SuigarClient {
224
116
  #private;
225
- constructor({ client, options, }: {
117
+ constructor({ client }: {
226
118
  client: ClientWithCoreApi;
227
- options: SuigarOptions;
228
119
  });
120
+ /**
121
+ * Returns the resolved SDK configuration for the connected network.
122
+ *
123
+ * This is primarily useful for debugging or inspecting which package ids,
124
+ * supported coin types, and price info object ids the SDK resolved for the
125
+ * current client network.
126
+ *
127
+ * @returns Network-resolved Suigar configuration.
128
+ */
129
+ getConfig(): SuigarConfig;
229
130
  /**
230
131
  * Builds a transaction with the configured Sui client and encodes the resulting BCS bytes as base64.
231
132
  *
@@ -245,19 +146,101 @@ declare class SuigarClient {
245
146
  /**
246
147
  * Event emitted at the end of a standard game (e.g., Coinflip, Limbo), containing the result and payout information.
247
148
  */
248
- BetResultEvent: typeof BetResultEvent;
149
+ BetResultEvent: MoveStruct<{
150
+ player: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
151
+ coin_type: MoveStruct<{
152
+ name: _mysten_bcs.BcsType<string, string, "string">;
153
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
154
+ stake_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
155
+ unsafe_oracle_usd_coin_price: MoveStruct<{
156
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
157
+ exp: MoveStruct<{
158
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
159
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
160
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
161
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
162
+ adjusted_oracle_usd_coin_price: MoveStruct<{
163
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
164
+ exp: MoveStruct<{
165
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
166
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
167
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
168
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
169
+ outcome_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
170
+ game_details: MoveStruct<{
171
+ contents: _mysten_bcs.BcsType<{
172
+ key: string;
173
+ value: number[];
174
+ }[], Iterable<{
175
+ key: string;
176
+ value: Iterable<number> & {
177
+ length: number;
178
+ };
179
+ }> & {
180
+ length: number;
181
+ }, string>;
182
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
183
+ metadata: MoveStruct<{
184
+ contents: _mysten_bcs.BcsType<{
185
+ key: string;
186
+ value: number[];
187
+ }[], Iterable<{
188
+ key: string;
189
+ value: Iterable<number> & {
190
+ length: number;
191
+ };
192
+ }> & {
193
+ length: number;
194
+ }, string>;
195
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
196
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::core::BetResultEvent<phantom T0>">;
249
197
  /**
250
198
  * Event emitted when a PvP Coinflip game is created, containing the game configuration and initial state.
251
199
  */
252
- PvPCoinflipGameCreated: typeof GameCreatedEvent;
200
+ PvPCoinflipGameCreated: MoveStruct<{
201
+ game_id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
202
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
203
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
204
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
205
+ joiner_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
206
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
207
+ house_edge_bps: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
208
+ coin_type: MoveStruct<{
209
+ name: _mysten_bcs.BcsType<string, string, "string">;
210
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
211
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCreatedEvent<phantom T0>">;
253
212
  /**
254
213
  * Event emitted when a PvP Coinflip game is resolved, containing the final outcome.
255
214
  */
256
- PvPCoinflipGameResolved: typeof GameResolvedEvent;
215
+ PvPCoinflipGameResolved: MoveStruct<{
216
+ game_id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
217
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
218
+ joiner: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
219
+ winner: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
220
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
221
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
222
+ joiner_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
223
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
224
+ total_pot: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
225
+ house_edge_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
226
+ payout_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
227
+ coin_type: MoveStruct<{
228
+ name: _mysten_bcs.BcsType<string, string, "string">;
229
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
230
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameResolvedEvent<phantom T0>">;
257
231
  /**
258
232
  * Event emitted when a PvP Coinflip game is cancelled.
259
233
  */
260
- PvPCoinflipGameCancelled: typeof GameCancelledEvent;
234
+ PvPCoinflipGameCancelled: MoveStruct<{
235
+ game_id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
236
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
237
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
238
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
239
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
240
+ coin_type: MoveStruct<{
241
+ name: _mysten_bcs.BcsType<string, string, "string">;
242
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
243
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCancelledEvent<phantom T0>">;
261
244
  };
262
245
  /**
263
246
  * Transaction builders for Suigar games.