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

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 = {
@@ -95,137 +107,25 @@ type BuildPvPCoinflipTransactionOptions<Action extends PvPCoinflipAction = PvPCo
95
107
 
96
108
  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
109
 
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>): {
110
+ declare function suigar<const Name = 'suigar'>({ name, }?: SuigarExtensionOptions<Name>): {
220
111
  name: Name;
221
112
  register: (client: ClientWithCoreApi) => SuigarClient;
222
113
  };
223
114
  declare class SuigarClient {
224
115
  #private;
225
- constructor({ client, options, }: {
116
+ constructor({ client }: {
226
117
  client: ClientWithCoreApi;
227
- options: SuigarOptions;
228
118
  });
119
+ /**
120
+ * Returns the resolved SDK configuration for the connected network.
121
+ *
122
+ * This is primarily useful for debugging or inspecting which package ids,
123
+ * supported coin types, and price info object ids the SDK resolved for the
124
+ * current client network.
125
+ *
126
+ * @returns Network-resolved Suigar configuration.
127
+ */
128
+ getConfig(): SuigarConfig;
229
129
  /**
230
130
  * Builds a transaction with the configured Sui client and encodes the resulting BCS bytes as base64.
231
131
  *
@@ -245,19 +145,101 @@ declare class SuigarClient {
245
145
  /**
246
146
  * Event emitted at the end of a standard game (e.g., Coinflip, Limbo), containing the result and payout information.
247
147
  */
248
- BetResultEvent: typeof BetResultEvent;
148
+ BetResultEvent: MoveStruct<{
149
+ player: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
150
+ coin_type: MoveStruct<{
151
+ name: _mysten_bcs.BcsType<string, string, "string">;
152
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
153
+ stake_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
154
+ unsafe_oracle_usd_coin_price: MoveStruct<{
155
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
156
+ exp: MoveStruct<{
157
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
158
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
159
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
160
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
161
+ adjusted_oracle_usd_coin_price: MoveStruct<{
162
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
163
+ exp: MoveStruct<{
164
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
165
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
166
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
167
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
168
+ outcome_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
169
+ game_details: MoveStruct<{
170
+ contents: _mysten_bcs.BcsType<{
171
+ key: string;
172
+ value: number[];
173
+ }[], Iterable<{
174
+ key: string;
175
+ value: Iterable<number> & {
176
+ length: number;
177
+ };
178
+ }> & {
179
+ length: number;
180
+ }, string>;
181
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
182
+ metadata: MoveStruct<{
183
+ contents: _mysten_bcs.BcsType<{
184
+ key: string;
185
+ value: number[];
186
+ }[], Iterable<{
187
+ key: string;
188
+ value: Iterable<number> & {
189
+ length: number;
190
+ };
191
+ }> & {
192
+ length: number;
193
+ }, string>;
194
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
195
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::core::BetResultEvent<phantom T0>">;
249
196
  /**
250
197
  * Event emitted when a PvP Coinflip game is created, containing the game configuration and initial state.
251
198
  */
252
- PvPCoinflipGameCreated: typeof GameCreatedEvent;
199
+ PvPCoinflipGameCreated: MoveStruct<{
200
+ game_id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
201
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
202
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
203
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
204
+ joiner_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
205
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
206
+ house_edge_bps: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
207
+ coin_type: MoveStruct<{
208
+ name: _mysten_bcs.BcsType<string, string, "string">;
209
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
210
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCreatedEvent<phantom T0>">;
253
211
  /**
254
212
  * Event emitted when a PvP Coinflip game is resolved, containing the final outcome.
255
213
  */
256
- PvPCoinflipGameResolved: typeof GameResolvedEvent;
214
+ PvPCoinflipGameResolved: MoveStruct<{
215
+ game_id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
216
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
217
+ joiner: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
218
+ winner: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
219
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
220
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
221
+ joiner_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
222
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
223
+ total_pot: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
224
+ house_edge_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
225
+ payout_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
226
+ coin_type: MoveStruct<{
227
+ name: _mysten_bcs.BcsType<string, string, "string">;
228
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
229
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameResolvedEvent<phantom T0>">;
257
230
  /**
258
231
  * Event emitted when a PvP Coinflip game is cancelled.
259
232
  */
260
- PvPCoinflipGameCancelled: typeof GameCancelledEvent;
233
+ PvPCoinflipGameCancelled: MoveStruct<{
234
+ game_id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
235
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
236
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
237
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
238
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
239
+ coin_type: MoveStruct<{
240
+ name: _mysten_bcs.BcsType<string, string, "string">;
241
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
242
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCancelledEvent<phantom T0>">;
261
243
  };
262
244
  /**
263
245
  * 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 = {
@@ -95,137 +107,25 @@ type BuildPvPCoinflipTransactionOptions<Action extends PvPCoinflipAction = PvPCo
95
107
 
96
108
  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
109
 
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>): {
110
+ declare function suigar<const Name = 'suigar'>({ name, }?: SuigarExtensionOptions<Name>): {
220
111
  name: Name;
221
112
  register: (client: ClientWithCoreApi) => SuigarClient;
222
113
  };
223
114
  declare class SuigarClient {
224
115
  #private;
225
- constructor({ client, options, }: {
116
+ constructor({ client }: {
226
117
  client: ClientWithCoreApi;
227
- options: SuigarOptions;
228
118
  });
119
+ /**
120
+ * Returns the resolved SDK configuration for the connected network.
121
+ *
122
+ * This is primarily useful for debugging or inspecting which package ids,
123
+ * supported coin types, and price info object ids the SDK resolved for the
124
+ * current client network.
125
+ *
126
+ * @returns Network-resolved Suigar configuration.
127
+ */
128
+ getConfig(): SuigarConfig;
229
129
  /**
230
130
  * Builds a transaction with the configured Sui client and encodes the resulting BCS bytes as base64.
231
131
  *
@@ -245,19 +145,101 @@ declare class SuigarClient {
245
145
  /**
246
146
  * Event emitted at the end of a standard game (e.g., Coinflip, Limbo), containing the result and payout information.
247
147
  */
248
- BetResultEvent: typeof BetResultEvent;
148
+ BetResultEvent: MoveStruct<{
149
+ player: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
150
+ coin_type: MoveStruct<{
151
+ name: _mysten_bcs.BcsType<string, string, "string">;
152
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
153
+ stake_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
154
+ unsafe_oracle_usd_coin_price: MoveStruct<{
155
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
156
+ exp: MoveStruct<{
157
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
158
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
159
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
160
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
161
+ adjusted_oracle_usd_coin_price: MoveStruct<{
162
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
163
+ exp: MoveStruct<{
164
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
165
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
166
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
167
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
168
+ outcome_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
169
+ game_details: MoveStruct<{
170
+ contents: _mysten_bcs.BcsType<{
171
+ key: string;
172
+ value: number[];
173
+ }[], Iterable<{
174
+ key: string;
175
+ value: Iterable<number> & {
176
+ length: number;
177
+ };
178
+ }> & {
179
+ length: number;
180
+ }, string>;
181
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
182
+ metadata: MoveStruct<{
183
+ contents: _mysten_bcs.BcsType<{
184
+ key: string;
185
+ value: number[];
186
+ }[], Iterable<{
187
+ key: string;
188
+ value: Iterable<number> & {
189
+ length: number;
190
+ };
191
+ }> & {
192
+ length: number;
193
+ }, string>;
194
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
195
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::core::BetResultEvent<phantom T0>">;
249
196
  /**
250
197
  * Event emitted when a PvP Coinflip game is created, containing the game configuration and initial state.
251
198
  */
252
- PvPCoinflipGameCreated: typeof GameCreatedEvent;
199
+ PvPCoinflipGameCreated: MoveStruct<{
200
+ game_id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
201
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
202
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
203
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
204
+ joiner_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
205
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
206
+ house_edge_bps: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
207
+ coin_type: MoveStruct<{
208
+ name: _mysten_bcs.BcsType<string, string, "string">;
209
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
210
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCreatedEvent<phantom T0>">;
253
211
  /**
254
212
  * Event emitted when a PvP Coinflip game is resolved, containing the final outcome.
255
213
  */
256
- PvPCoinflipGameResolved: typeof GameResolvedEvent;
214
+ PvPCoinflipGameResolved: MoveStruct<{
215
+ game_id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
216
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
217
+ joiner: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
218
+ winner: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
219
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
220
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
221
+ joiner_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
222
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
223
+ total_pot: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
224
+ house_edge_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
225
+ payout_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
226
+ coin_type: MoveStruct<{
227
+ name: _mysten_bcs.BcsType<string, string, "string">;
228
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
229
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameResolvedEvent<phantom T0>">;
257
230
  /**
258
231
  * Event emitted when a PvP Coinflip game is cancelled.
259
232
  */
260
- PvPCoinflipGameCancelled: typeof GameCancelledEvent;
233
+ PvPCoinflipGameCancelled: MoveStruct<{
234
+ game_id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
235
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
236
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
237
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
238
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
239
+ coin_type: MoveStruct<{
240
+ name: _mysten_bcs.BcsType<string, string, "string">;
241
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
242
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCancelledEvent<phantom T0>">;
261
243
  };
262
244
  /**
263
245
  * Transaction builders for Suigar games.