@suigar/sdk 2.0.0-beta.13 → 2.0.0-beta.14

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/CHANGELOG.md CHANGED
@@ -1,10 +1,21 @@
1
1
  # @suigar/sdk
2
2
 
3
+ ## 2.0.0-beta.14
4
+
5
+ ### Patch Changes
6
+
7
+ - f846d27: Rename exported SDK config types to distinguish key unions from ID maps more clearly.
8
+ - Rename `SuigarPackageKey` to `SuigarPackage`.
9
+ - Rename the old `SuigarPackage` record type to `SuigarPackageIds`.
10
+ - Rename `SuigarRegistryKey` to `SuigarRegistry`.
11
+ - Rename the old `SuigarRegistry` record type to `SuigarRegistryIds`.
12
+ - Rename `SuigarPriceInfoObjectId` to `SuigarPriceInfoObjectIds`.
13
+
3
14
  ## 2.0.0-beta.13
4
15
 
5
16
  ### Patch Changes
6
17
 
7
- - 667d7c4: Normalize authored repository wording to use `on-chain` consistently.
18
+ - 667d7c4: Normalize repository wording to use `on-chain` consistently.
8
19
 
9
20
  ## 2.0.0-beta.12
10
21
 
@@ -85,18 +96,18 @@
85
96
 
86
97
  ### Patch Changes
87
98
 
88
- - 6daa819: Add BCS parser helpers and a Next.js game integration example app.
99
+ - 6daa819: Add BCS parser helpers and a Next.js playground example app.
89
100
  - expose parser helpers through `@suigar/sdk/utils`
90
101
  - add `parseGameDetails` for decoding `BetResultEvent.game_details`
91
102
  - document generated BCS event decoding and game detail parsing guidance
92
- - add a testnet-only `apps/playground` app for standard and PvP Suigar transactions
103
+ - add a testnet-only app for standard and PvP Suigar transactions
93
104
  - integrate Mysten dApp Kit wallet connection, signing, and execution
94
105
  - add live transaction code previews and shared decoded event logging with SDK parser helpers
95
106
  - add Suigar-themed responsive UI, supported coin selection, and human-readable stake handling
96
107
  - update PvP coinflip join so callers only provide `gameId` and the SDK derives the join stake while using the configured price info object id
97
108
 
98
109
  - b89d0b4: Add a public `@suigar/sdk/games` export subpath for shared game option types, and export `SuigarClient` from the package root.
99
- - bf1f71b: Add `registryIds` to `SuigarConfig` and resolve it from the network config registry map.
110
+ - bf1f71b: Add `registryIds` to `SuigarConfig` and resolve them from the network config registry map.
100
111
 
101
112
  Document the PvP coinflip runtime helpers more clearly by describing
102
113
  registry-backed unresolved game discovery through `getPvPCoinflipGames()` and
@@ -28,16 +28,16 @@ interface SuigarExtensionOptions<Name = 'suigar'> {
28
28
  }
29
29
  type SuigarCoin = 'sui' | 'usdc';
30
30
  type SuigarCoinTypes = Record<SuigarCoin, string>;
31
- type SuigarPackageKey = 'sweetHouse' | 'core' | 'coinflip' | 'limbo' | 'plinko' | 'pvpCoinflip' | 'range' | 'wheel';
32
- type SuigarPackage = Record<SuigarPackageKey, string>;
33
- type SuigarPriceInfoObjectId = Record<SuigarCoin, string>;
34
- type SuigarRegistryKey = 'pvpCoinflip';
35
- type SuigarRegistryId = Record<SuigarRegistryKey, string>;
31
+ type SuigarPackage = 'sweetHouse' | 'core' | 'coinflip' | 'limbo' | 'plinko' | 'pvpCoinflip' | 'range' | 'wheel';
32
+ type SuigarPackageIds = Record<SuigarPackage, string>;
33
+ type SuigarRegistry = 'pvpCoinflip';
34
+ type SuigarRegistryIds = Record<SuigarRegistry, string>;
35
+ type SuigarPriceInfoObjectIds = Record<SuigarCoin, string>;
36
36
  type SuigarConfig = {
37
- packageIds: SuigarPackage;
38
- registryIds: SuigarRegistryId;
37
+ packageIds: SuigarPackageIds;
38
+ registryIds: SuigarRegistryIds;
39
39
  coinTypes: SuigarCoinTypes;
40
- priceInfoObjectIds: SuigarPriceInfoObjectId;
40
+ priceInfoObjectIds: SuigarPriceInfoObjectIds;
41
41
  };
42
42
 
43
43
  type WithGasBudget = {
@@ -28,16 +28,16 @@ interface SuigarExtensionOptions<Name = 'suigar'> {
28
28
  }
29
29
  type SuigarCoin = 'sui' | 'usdc';
30
30
  type SuigarCoinTypes = Record<SuigarCoin, string>;
31
- type SuigarPackageKey = 'sweetHouse' | 'core' | 'coinflip' | 'limbo' | 'plinko' | 'pvpCoinflip' | 'range' | 'wheel';
32
- type SuigarPackage = Record<SuigarPackageKey, string>;
33
- type SuigarPriceInfoObjectId = Record<SuigarCoin, string>;
34
- type SuigarRegistryKey = 'pvpCoinflip';
35
- type SuigarRegistryId = Record<SuigarRegistryKey, string>;
31
+ type SuigarPackage = 'sweetHouse' | 'core' | 'coinflip' | 'limbo' | 'plinko' | 'pvpCoinflip' | 'range' | 'wheel';
32
+ type SuigarPackageIds = Record<SuigarPackage, string>;
33
+ type SuigarRegistry = 'pvpCoinflip';
34
+ type SuigarRegistryIds = Record<SuigarRegistry, string>;
35
+ type SuigarPriceInfoObjectIds = Record<SuigarCoin, string>;
36
36
  type SuigarConfig = {
37
- packageIds: SuigarPackage;
38
- registryIds: SuigarRegistryId;
37
+ packageIds: SuigarPackageIds;
38
+ registryIds: SuigarRegistryIds;
39
39
  coinTypes: SuigarCoinTypes;
40
- priceInfoObjectIds: SuigarPriceInfoObjectId;
40
+ priceInfoObjectIds: SuigarPriceInfoObjectIds;
41
41
  };
42
42
 
43
43
  type WithGasBudget = {
package/dist/games.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- export { h as BuildCancelPvPCoinflipTransactionOptions, B as BuildCoinflipTransactionOptions, i as BuildCreatePvPCoinflipTransactionOptions, j as BuildJoinPvPCoinflipTransactionOptions, b as BuildLimboTransactionOptions, c as BuildPlinkoTransactionOptions, d as BuildRangeTransactionOptions, a as BuildWheelTransactionOptions, C as CoinSide, P as PvPCoinflipAction } from './games-BHYRg31e.cjs';
1
+ export { h as BuildCancelPvPCoinflipTransactionOptions, B as BuildCoinflipTransactionOptions, i as BuildCreatePvPCoinflipTransactionOptions, j as BuildJoinPvPCoinflipTransactionOptions, b as BuildLimboTransactionOptions, c as BuildPlinkoTransactionOptions, d as BuildRangeTransactionOptions, a as BuildWheelTransactionOptions, C as CoinSide, P as PvPCoinflipAction } from './games-Da2uZvVJ.cjs';
2
2
  import '@mysten/sui/transactions';
package/dist/games.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { h as BuildCancelPvPCoinflipTransactionOptions, B as BuildCoinflipTransactionOptions, i as BuildCreatePvPCoinflipTransactionOptions, j as BuildJoinPvPCoinflipTransactionOptions, b as BuildLimboTransactionOptions, c as BuildPlinkoTransactionOptions, d as BuildRangeTransactionOptions, a as BuildWheelTransactionOptions, C as CoinSide, P as PvPCoinflipAction } from './games-BHYRg31e.js';
1
+ export { h as BuildCancelPvPCoinflipTransactionOptions, B as BuildCoinflipTransactionOptions, i as BuildCreatePvPCoinflipTransactionOptions, j as BuildJoinPvPCoinflipTransactionOptions, b as BuildLimboTransactionOptions, c as BuildPlinkoTransactionOptions, d as BuildRangeTransactionOptions, a as BuildWheelTransactionOptions, C as CoinSide, P as PvPCoinflipAction } from './games-Da2uZvVJ.js';
2
2
  import '@mysten/sui/transactions';
package/dist/index.cjs CHANGED
@@ -415,19 +415,19 @@ var PRICE_INFO_OBJECT_IDS = {
415
415
  };
416
416
 
417
417
  // src/configs/registry.mainnet.ts
418
- var PVP_COINFLIP_REGISTRY_ID = "0x3d73568546c539c1da3eb2b8fe917faef3c0acdbec78a67fe6d52800a0729349";
418
+ var MAINNET_REGISTRY_IDS = {
419
+ pvpCoinflip: "0x3d73568546c539c1da3eb2b8fe917faef3c0acdbec78a67fe6d52800a0729349"
420
+ };
419
421
 
420
422
  // src/configs/registry.testnet.ts
421
- var PVP_COINFLIP_REGISTRY_ID2 = "0x99f20d8e4be012ea14a681144ae72ac349d0a1a1585205880183eb167f075bad";
423
+ var TESTNET_REGISTRY_IDS = {
424
+ pvpCoinflip: "0x99f20d8e4be012ea14a681144ae72ac349d0a1a1585205880183eb167f075bad"
425
+ };
422
426
 
423
427
  // src/configs/registry.ts
424
428
  var REGISTRY_IDS = {
425
- mainnet: {
426
- pvpCoinflip: PVP_COINFLIP_REGISTRY_ID
427
- },
428
- testnet: {
429
- pvpCoinflip: PVP_COINFLIP_REGISTRY_ID2
430
- }
429
+ mainnet: { ...MAINNET_REGISTRY_IDS },
430
+ testnet: { ...TESTNET_REGISTRY_IDS }
431
431
  };
432
432
 
433
433
  // src/helpers/config.ts
package/dist/index.d.cts CHANGED
@@ -2,9 +2,36 @@ import { M as MoveStruct } from './index-3P_LBbDM.cjs';
2
2
  import * as _mysten_bcs from '@mysten/bcs';
3
3
  import { SuiClientTypes, ClientWithCoreApi } from '@mysten/sui/client';
4
4
  import { Transaction, BuildTransactionOptions } from '@mysten/sui/transactions';
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';
5
+ import { S as StandardGame, B as BuildCoinflipTransactionOptions, a as BuildWheelTransactionOptions, b as BuildLimboTransactionOptions, c as BuildPlinkoTransactionOptions, d as BuildRangeTransactionOptions, G as Game$1, e as SuigarConfig, W as WithThrowOnError, P as PvPCoinflipAction, f as BuildPvPCoinflipTransactionOptions, g as SuigarExtensionOptions } from './games-Da2uZvVJ.cjs';
6
6
  import '@mysten/sui/bcs';
7
7
 
8
+ declare const Game: MoveStruct<{
9
+ id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
10
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
11
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
12
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
13
+ creator_metadata: MoveStruct<{
14
+ contents: _mysten_bcs.BcsType<{
15
+ key: string;
16
+ value: number[];
17
+ }[], Iterable<{
18
+ key: string;
19
+ value: Iterable<number> & {
20
+ length: number;
21
+ };
22
+ }> & {
23
+ length: number;
24
+ }, string>;
25
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
26
+ joiner: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
27
+ winner: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
28
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
29
+ house_edge_bps: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
30
+ stake_pot: MoveStruct<{
31
+ value: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
32
+ }, "0x2::balance::Balance<phantom T0>">;
33
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::Game<phantom T0>">;
34
+
8
35
  type WithoutConfig<T> = Omit<T, 'config'>;
9
36
  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;
10
37
 
@@ -195,9 +222,9 @@ declare const GAME_SETTINGS: {
195
222
  };
196
223
  };
197
224
  type GameParametersMap = {
198
- [TGame in Game]: ReturnType<(typeof GAME_SETTINGS)[TGame]['parameters']['parse']>;
225
+ [TGame in Game$1]: ReturnType<(typeof GAME_SETTINGS)[TGame]['parameters']['parse']>;
199
226
  };
200
- type GameParameters<TGame extends Game> = GameParametersMap[TGame];
227
+ type GameParameters<TGame extends Game$1> = GameParametersMap[TGame];
201
228
  type GetGameParametersOptions = SuiClientTypes.CoreClientMethodOptions & {
202
229
  coinType?: string;
203
230
  ignoreCache?: boolean;
@@ -250,7 +277,7 @@ declare class SuigarClient {
250
277
  * @param options Optional coin type, cache override, and abort signal.
251
278
  * @returns Parsed game parameters typed for the requested game.
252
279
  */
253
- getGameParameters<TGame extends Game>(game: TGame, options?: GetGameParametersOptions): Promise<GameParameters<TGame>>;
280
+ getGameParameters<TGame extends Game$1>(game: TGame, options?: GetGameParametersOptions): Promise<GameParameters<TGame>>;
254
281
  /**
255
282
  * Lists unresolved PvP coinflip games from the configured registry and resolves
256
283
  * each entry into parsed on-chain game state.
@@ -272,26 +299,9 @@ declare class SuigarClient {
272
299
  * registry page. When `throwOnError` is `false`, entries that fail object fetch
273
300
  * or parse are omitted from the returned array.
274
301
  */
275
- getPvPCoinflipGames(options?: WithThrowOnError<Omit<SuiClientTypes.ListDynamicFieldsOptions, 'parentId'>>): Promise<{
302
+ getPvPCoinflipGames(options?: WithThrowOnError<Omit<SuiClientTypes.ListDynamicFieldsOptions, 'parentId'>>): Promise<((typeof Game)['$inferType'] & {
276
303
  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
- }[]>;
304
+ })[]>;
295
305
  /**
296
306
  * BCS struct constructors for decoding on-chain objects and events related to Suigar games.
297
307
  *
package/dist/index.d.ts CHANGED
@@ -2,9 +2,36 @@ import { M as MoveStruct } from './index-3P_LBbDM.js';
2
2
  import * as _mysten_bcs from '@mysten/bcs';
3
3
  import { SuiClientTypes, ClientWithCoreApi } from '@mysten/sui/client';
4
4
  import { Transaction, BuildTransactionOptions } from '@mysten/sui/transactions';
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.js';
5
+ import { S as StandardGame, B as BuildCoinflipTransactionOptions, a as BuildWheelTransactionOptions, b as BuildLimboTransactionOptions, c as BuildPlinkoTransactionOptions, d as BuildRangeTransactionOptions, G as Game$1, e as SuigarConfig, W as WithThrowOnError, P as PvPCoinflipAction, f as BuildPvPCoinflipTransactionOptions, g as SuigarExtensionOptions } from './games-Da2uZvVJ.js';
6
6
  import '@mysten/sui/bcs';
7
7
 
8
+ declare const Game: MoveStruct<{
9
+ id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
10
+ creator: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
11
+ creator_is_tails: _mysten_bcs.BcsType<boolean, boolean, "bool">;
12
+ is_private: _mysten_bcs.BcsType<boolean, boolean, "bool">;
13
+ creator_metadata: MoveStruct<{
14
+ contents: _mysten_bcs.BcsType<{
15
+ key: string;
16
+ value: number[];
17
+ }[], Iterable<{
18
+ key: string;
19
+ value: Iterable<number> & {
20
+ length: number;
21
+ };
22
+ }> & {
23
+ length: number;
24
+ }, string>;
25
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
26
+ joiner: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
27
+ winner: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
28
+ stake_per_player: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
29
+ house_edge_bps: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
30
+ stake_pot: MoveStruct<{
31
+ value: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
32
+ }, "0x2::balance::Balance<phantom T0>">;
33
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::Game<phantom T0>">;
34
+
8
35
  type WithoutConfig<T> = Omit<T, 'config'>;
9
36
  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;
10
37
 
@@ -195,9 +222,9 @@ declare const GAME_SETTINGS: {
195
222
  };
196
223
  };
197
224
  type GameParametersMap = {
198
- [TGame in Game]: ReturnType<(typeof GAME_SETTINGS)[TGame]['parameters']['parse']>;
225
+ [TGame in Game$1]: ReturnType<(typeof GAME_SETTINGS)[TGame]['parameters']['parse']>;
199
226
  };
200
- type GameParameters<TGame extends Game> = GameParametersMap[TGame];
227
+ type GameParameters<TGame extends Game$1> = GameParametersMap[TGame];
201
228
  type GetGameParametersOptions = SuiClientTypes.CoreClientMethodOptions & {
202
229
  coinType?: string;
203
230
  ignoreCache?: boolean;
@@ -250,7 +277,7 @@ declare class SuigarClient {
250
277
  * @param options Optional coin type, cache override, and abort signal.
251
278
  * @returns Parsed game parameters typed for the requested game.
252
279
  */
253
- getGameParameters<TGame extends Game>(game: TGame, options?: GetGameParametersOptions): Promise<GameParameters<TGame>>;
280
+ getGameParameters<TGame extends Game$1>(game: TGame, options?: GetGameParametersOptions): Promise<GameParameters<TGame>>;
254
281
  /**
255
282
  * Lists unresolved PvP coinflip games from the configured registry and resolves
256
283
  * each entry into parsed on-chain game state.
@@ -272,26 +299,9 @@ declare class SuigarClient {
272
299
  * registry page. When `throwOnError` is `false`, entries that fail object fetch
273
300
  * or parse are omitted from the returned array.
274
301
  */
275
- getPvPCoinflipGames(options?: WithThrowOnError<Omit<SuiClientTypes.ListDynamicFieldsOptions, 'parentId'>>): Promise<{
302
+ getPvPCoinflipGames(options?: WithThrowOnError<Omit<SuiClientTypes.ListDynamicFieldsOptions, 'parentId'>>): Promise<((typeof Game)['$inferType'] & {
276
303
  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
- }[]>;
304
+ })[]>;
295
305
  /**
296
306
  * BCS struct constructors for decoding on-chain objects and events related to Suigar games.
297
307
  *
package/dist/index.js CHANGED
@@ -255,19 +255,19 @@ var PRICE_INFO_OBJECT_IDS = {
255
255
  };
256
256
 
257
257
  // src/configs/registry.mainnet.ts
258
- var PVP_COINFLIP_REGISTRY_ID = "0x3d73568546c539c1da3eb2b8fe917faef3c0acdbec78a67fe6d52800a0729349";
258
+ var MAINNET_REGISTRY_IDS = {
259
+ pvpCoinflip: "0x3d73568546c539c1da3eb2b8fe917faef3c0acdbec78a67fe6d52800a0729349"
260
+ };
259
261
 
260
262
  // src/configs/registry.testnet.ts
261
- var PVP_COINFLIP_REGISTRY_ID2 = "0x99f20d8e4be012ea14a681144ae72ac349d0a1a1585205880183eb167f075bad";
263
+ var TESTNET_REGISTRY_IDS = {
264
+ pvpCoinflip: "0x99f20d8e4be012ea14a681144ae72ac349d0a1a1585205880183eb167f075bad"
265
+ };
262
266
 
263
267
  // src/configs/registry.ts
264
268
  var REGISTRY_IDS = {
265
- mainnet: {
266
- pvpCoinflip: PVP_COINFLIP_REGISTRY_ID
267
- },
268
- testnet: {
269
- pvpCoinflip: PVP_COINFLIP_REGISTRY_ID2
270
- }
269
+ mainnet: { ...MAINNET_REGISTRY_IDS },
270
+ testnet: { ...TESTNET_REGISTRY_IDS }
271
271
  };
272
272
 
273
273
  // src/helpers/config.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suigar/sdk",
3
- "version": "2.0.0-beta.13",
3
+ "version": "2.0.0-beta.14",
4
4
  "description": "TypeScript SDK for Suigar v2 Move contracts on Sui.",
5
5
  "keywords": [
6
6
  "suigar",