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

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.
Files changed (160) hide show
  1. package/CHANGELOG.md +23 -4
  2. package/README.md +22 -8
  3. package/dist/client.d.mts +258 -0
  4. package/dist/client.d.mts.map +1 -0
  5. package/dist/client.mjs +291 -0
  6. package/dist/client.mjs.map +1 -0
  7. package/dist/configs/package.mainnet.mjs +23 -0
  8. package/dist/configs/package.mainnet.mjs.map +1 -0
  9. package/dist/configs/package.mjs +19 -0
  10. package/dist/configs/package.mjs.map +1 -0
  11. package/dist/configs/package.testnet.mjs +23 -0
  12. package/dist/configs/package.testnet.mjs.map +1 -0
  13. package/dist/configs/registry.mainnet.mjs +6 -0
  14. package/dist/configs/registry.mainnet.mjs.map +1 -0
  15. package/dist/configs/registry.mjs +11 -0
  16. package/dist/configs/registry.mjs.map +1 -0
  17. package/dist/configs/registry.testnet.mjs +6 -0
  18. package/dist/configs/registry.testnet.mjs.map +1 -0
  19. package/dist/contracts/coinflip/coinflip.mjs +46 -0
  20. package/dist/contracts/coinflip/coinflip.mjs.map +1 -0
  21. package/dist/contracts/core/core.d.mts +55 -0
  22. package/dist/contracts/core/core.d.mts.map +1 -0
  23. package/dist/contracts/core/core.mjs +22 -0
  24. package/dist/contracts/core/core.mjs.map +1 -0
  25. package/dist/contracts/core/deps/0x0000000000000000000000000000000000000000000000000000000000000001/type_name.mjs +10 -0
  26. package/dist/contracts/core/deps/0x0000000000000000000000000000000000000000000000000000000000000001/type_name.mjs.map +1 -0
  27. package/dist/contracts/core/deps/0x0000000000000000000000000000000000000000000000000000000000000002/vec_map.mjs +26 -0
  28. package/dist/contracts/core/deps/0x0000000000000000000000000000000000000000000000000000000000000002/vec_map.mjs.map +1 -0
  29. package/dist/contracts/core/float.d.mts +14 -0
  30. package/dist/contracts/core/float.d.mts.map +1 -0
  31. package/dist/contracts/core/float.mjs +15 -0
  32. package/dist/contracts/core/float.mjs.map +1 -0
  33. package/dist/contracts/core/i64.mjs +10 -0
  34. package/dist/contracts/core/i64.mjs.map +1 -0
  35. package/dist/contracts/limbo/deps/0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc/float.mjs +15 -0
  36. package/dist/contracts/limbo/deps/0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc/float.mjs.map +1 -0
  37. package/dist/contracts/limbo/deps/0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc/i64.mjs +10 -0
  38. package/dist/contracts/limbo/deps/0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc/i64.mjs.map +1 -0
  39. package/dist/contracts/limbo/limbo.mjs +53 -0
  40. package/dist/contracts/limbo/limbo.mjs.map +1 -0
  41. package/dist/contracts/plinko/deps/0x0000000000000000000000000000000000000000000000000000000000000002/vec_map.mjs +26 -0
  42. package/dist/contracts/plinko/deps/0x0000000000000000000000000000000000000000000000000000000000000002/vec_map.mjs.map +1 -0
  43. package/dist/contracts/plinko/deps/0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc/float.mjs +15 -0
  44. package/dist/contracts/plinko/deps/0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc/float.mjs.map +1 -0
  45. package/dist/contracts/plinko/deps/0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc/i64.mjs +10 -0
  46. package/dist/contracts/plinko/deps/0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc/i64.mjs.map +1 -0
  47. package/dist/contracts/plinko/plinko.mjs +59 -0
  48. package/dist/contracts/plinko/plinko.mjs.map +1 -0
  49. package/dist/contracts/pvp-coinflip/deps/0x0000000000000000000000000000000000000000000000000000000000000001/type_name.mjs +10 -0
  50. package/dist/contracts/pvp-coinflip/deps/0x0000000000000000000000000000000000000000000000000000000000000001/type_name.mjs.map +1 -0
  51. package/dist/contracts/pvp-coinflip/deps/0x0000000000000000000000000000000000000000000000000000000000000002/balance.mjs +10 -0
  52. package/dist/contracts/pvp-coinflip/deps/0x0000000000000000000000000000000000000000000000000000000000000002/balance.mjs.map +1 -0
  53. package/dist/contracts/pvp-coinflip/deps/0x0000000000000000000000000000000000000000000000000000000000000002/vec_map.mjs +26 -0
  54. package/dist/contracts/pvp-coinflip/deps/0x0000000000000000000000000000000000000000000000000000000000000002/vec_map.mjs.map +1 -0
  55. package/dist/contracts/pvp-coinflip/pvp_coinflip.d.mts +34 -0
  56. package/dist/contracts/pvp-coinflip/pvp_coinflip.d.mts.map +1 -0
  57. package/dist/contracts/pvp-coinflip/pvp_coinflip.mjs +131 -0
  58. package/dist/contracts/pvp-coinflip/pvp_coinflip.mjs.map +1 -0
  59. package/dist/contracts/range/deps/0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc/float.mjs +15 -0
  60. package/dist/contracts/range/deps/0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc/float.mjs.map +1 -0
  61. package/dist/contracts/range/deps/0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc/i64.mjs +10 -0
  62. package/dist/contracts/range/deps/0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc/i64.mjs.map +1 -0
  63. package/dist/contracts/range/range.mjs +53 -0
  64. package/dist/contracts/range/range.mjs.map +1 -0
  65. package/dist/contracts/utils/index.d.mts +33 -0
  66. package/dist/contracts/utils/index.d.mts.map +1 -0
  67. package/dist/contracts/utils/index.mjs +119 -0
  68. package/dist/contracts/utils/index.mjs.map +1 -0
  69. package/dist/contracts/wheel/deps/0x0000000000000000000000000000000000000000000000000000000000000002/vec_map.mjs +26 -0
  70. package/dist/contracts/wheel/deps/0x0000000000000000000000000000000000000000000000000000000000000002/vec_map.mjs.map +1 -0
  71. package/dist/contracts/wheel/deps/0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc/float.mjs +15 -0
  72. package/dist/contracts/wheel/deps/0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc/float.mjs.map +1 -0
  73. package/dist/contracts/wheel/deps/0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc/i64.mjs +10 -0
  74. package/dist/contracts/wheel/deps/0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc/i64.mjs.map +1 -0
  75. package/dist/contracts/wheel/wheel.mjs +59 -0
  76. package/dist/contracts/wheel/wheel.mjs.map +1 -0
  77. package/dist/games.d.mts +3 -0
  78. package/dist/games.mjs +1 -0
  79. package/dist/helpers/config.mjs +51 -0
  80. package/dist/helpers/config.mjs.map +1 -0
  81. package/dist/helpers/game-settings.mjs +19 -0
  82. package/dist/helpers/game-settings.mjs.map +1 -0
  83. package/dist/helpers/metadata.mjs +42 -0
  84. package/dist/helpers/metadata.mjs.map +1 -0
  85. package/dist/index.d.mts +2 -0
  86. package/dist/index.mjs +2 -0
  87. package/dist/transactions/coinflip.mjs +27 -0
  88. package/dist/transactions/coinflip.mjs.map +1 -0
  89. package/dist/transactions/limbo.mjs +31 -0
  90. package/dist/transactions/limbo.mjs.map +1 -0
  91. package/dist/transactions/plinko.mjs +29 -0
  92. package/dist/transactions/plinko.mjs.map +1 -0
  93. package/dist/transactions/pvp-coinflip.mjs +70 -0
  94. package/dist/transactions/pvp-coinflip.mjs.map +1 -0
  95. package/dist/transactions/range.mjs +33 -0
  96. package/dist/transactions/range.mjs.map +1 -0
  97. package/dist/transactions/shared.mjs +49 -0
  98. package/dist/transactions/shared.mjs.map +1 -0
  99. package/dist/transactions/wheel.mjs +29 -0
  100. package/dist/transactions/wheel.mjs.map +1 -0
  101. package/dist/ttl-cache.mjs +60 -0
  102. package/dist/ttl-cache.mjs.map +1 -0
  103. package/dist/types/bet-metadata.type.d.mts +7 -0
  104. package/dist/types/bet-metadata.type.d.mts.map +1 -0
  105. package/dist/types/build-game-transaction-options.type.d.mts +9 -0
  106. package/dist/types/build-game-transaction-options.type.d.mts.map +1 -0
  107. package/dist/types/game-details.type.d.mts +73 -0
  108. package/dist/types/game-details.type.d.mts.map +1 -0
  109. package/dist/types/game-details.type.mjs +59 -0
  110. package/dist/types/game-details.type.mjs.map +1 -0
  111. package/dist/types/game-settings.type.d.mts +201 -0
  112. package/dist/types/game-settings.type.d.mts.map +1 -0
  113. package/dist/types/game-settings.type.mjs +37 -0
  114. package/dist/types/game-settings.type.mjs.map +1 -0
  115. package/dist/types/game.type.d.mts +15 -0
  116. package/dist/types/game.type.d.mts.map +1 -0
  117. package/dist/types/game.type.mjs +19 -0
  118. package/dist/types/game.type.mjs.map +1 -0
  119. package/dist/types/index.d.mts +7 -0
  120. package/dist/types/move-float.type.d.mts +7 -0
  121. package/dist/types/move-float.type.d.mts.map +1 -0
  122. package/dist/types/network.type.d.mts +1 -0
  123. package/dist/types/network.type.mjs +6 -0
  124. package/dist/types/network.type.mjs.map +1 -0
  125. package/dist/types/suigar-config.type.d.mts +33 -0
  126. package/dist/types/suigar-config.type.d.mts.map +1 -0
  127. package/dist/types/transaction-options.type.d.mts +63 -0
  128. package/dist/types/transaction-options.type.d.mts.map +1 -0
  129. package/dist/utils/constants.d.mts +8 -0
  130. package/dist/utils/constants.d.mts.map +1 -0
  131. package/dist/utils/constants.mjs +10 -0
  132. package/dist/utils/constants.mjs.map +1 -0
  133. package/dist/utils/numeric.d.mts +86 -0
  134. package/dist/utils/numeric.d.mts.map +1 -0
  135. package/dist/utils/numeric.mjs +148 -0
  136. package/dist/utils/numeric.mjs.map +1 -0
  137. package/dist/utils/parser.d.mts +54 -0
  138. package/dist/utils/parser.d.mts.map +1 -0
  139. package/dist/utils/parser.mjs +94 -0
  140. package/dist/utils/parser.mjs.map +1 -0
  141. package/dist/utils.d.mts +4 -0
  142. package/dist/utils.mjs +4 -0
  143. package/package.json +16 -17
  144. package/dist/chunk-7N55D2TV.js +0 -343
  145. package/dist/games-BHYRg31e.d.cts +0 -98
  146. package/dist/games-BHYRg31e.d.ts +0 -98
  147. package/dist/games.cjs +0 -2
  148. package/dist/games.d.cts +0 -2
  149. package/dist/games.d.ts +0 -2
  150. package/dist/games.js +0 -1
  151. package/dist/index-3P_LBbDM.d.cts +0 -25
  152. package/dist/index-3P_LBbDM.d.ts +0 -25
  153. package/dist/index.cjs +0 -1692
  154. package/dist/index.d.cts +0 -457
  155. package/dist/index.d.ts +0 -457
  156. package/dist/index.js +0 -1470
  157. package/dist/utils.cjs +0 -243
  158. package/dist/utils.d.cts +0 -180
  159. package/dist/utils.d.ts +0 -180
  160. package/dist/utils.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,10 +1,29 @@
1
1
  # @suigar/sdk
2
2
 
3
+ ## 2.0.0-beta.15
4
+
5
+ ### Patch Changes
6
+
7
+ - 67a8b5b: Add `parseGameEvent` to `@suigar/sdk/utils` for extracting a normalized Suigar game id plus raw Move event name for supported Suigar events in `GAME_EVENTS`, including standard `BetResultEvent` and PvP coinflip events.
8
+
9
+ Change `parseGameDetails` to accept `gameId` first so TypeScript can narrow the returned detail keys and value types per game.
10
+
11
+ ## 2.0.0-beta.14
12
+
13
+ ### Patch Changes
14
+
15
+ - f846d27: Rename exported SDK config types to distinguish key unions from ID maps more clearly.
16
+ - Rename `SuigarPackageKey` to `SuigarPackage`.
17
+ - Rename the old `SuigarPackage` record type to `SuigarPackageIds`.
18
+ - Rename `SuigarRegistryKey` to `SuigarRegistry`.
19
+ - Rename the old `SuigarRegistry` record type to `SuigarRegistryIds`.
20
+ - Rename `SuigarPriceInfoObjectId` to `SuigarPriceInfoObjectIds`.
21
+
3
22
  ## 2.0.0-beta.13
4
23
 
5
24
  ### Patch Changes
6
25
 
7
- - 667d7c4: Normalize authored repository wording to use `on-chain` consistently.
26
+ - 667d7c4: Normalize repository wording to use `on-chain` consistently.
8
27
 
9
28
  ## 2.0.0-beta.12
10
29
 
@@ -85,18 +104,18 @@
85
104
 
86
105
  ### Patch Changes
87
106
 
88
- - 6daa819: Add BCS parser helpers and a Next.js game integration example app.
107
+ - 6daa819: Add BCS parser helpers and a Next.js playground example app.
89
108
  - expose parser helpers through `@suigar/sdk/utils`
90
109
  - add `parseGameDetails` for decoding `BetResultEvent.game_details`
91
110
  - document generated BCS event decoding and game detail parsing guidance
92
- - add a testnet-only `apps/playground` app for standard and PvP Suigar transactions
111
+ - add a testnet-only app for standard and PvP Suigar transactions
93
112
  - integrate Mysten dApp Kit wallet connection, signing, and execution
94
113
  - add live transaction code previews and shared decoded event logging with SDK parser helpers
95
114
  - add Suigar-themed responsive UI, supported coin selection, and human-readable stake handling
96
115
  - 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
116
 
98
117
  - 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.
118
+ - bf1f71b: Add `registryIds` to `SuigarConfig` and resolve them from the network config registry map.
100
119
 
101
120
  Document the PvP coinflip runtime helpers more clearly by describing
102
121
  registry-backed unresolved game discovery through `getPvPCoinflipGames()` and
package/README.md CHANGED
@@ -10,7 +10,7 @@ npm install --save @suigar/sdk @mysten/sui @mysten/bcs
10
10
 
11
11
  Runtime requirements:
12
12
 
13
- - Node.js `>=22`
13
+ - Node.js `^22.18.0 || >=24`
14
14
  - ESM project configuration (`"type": "module"`)
15
15
  - `@mysten/sui` v2
16
16
  - `@mysten/bcs` v2
@@ -71,7 +71,7 @@ Numeric helper behavior:
71
71
  JavaScript `number`
72
72
  - `parseCoinType(type)` extracts the normalized first generic coin type from a
73
73
  Move object type string and throws `TypeError` when no coin type can be parsed
74
- - `parseGameDetails(gameDetails)` decodes standard `BetResultEvent.game_details`
74
+ - `parseGameDetails(gameId, gameDetails)` decodes standard `BetResultEvent.game_details`
75
75
  byte arrays into the expected string, number, and boolean values while
76
76
  preserving the original on-chain keys
77
77
 
@@ -267,6 +267,9 @@ By default, per-object fetch or parse failures are skipped so one broken or
267
267
  already-deleted registry entry does not reject the full lookup. Pass
268
268
  `throwOnError: true` if you want the call to reject instead.
269
269
 
270
+ Each returned entry includes the parsed game fields plus a derived
271
+ `coin_type` string from the underlying Move object type.
272
+
270
273
  Any supported `listDynamicFields()` options such as `limit`, `cursor`, or
271
274
  `signal` can be passed through `options`.
272
275
 
@@ -275,7 +278,7 @@ const games = await client.suigar.getPvPCoinflipGames({ limit: 20 });
275
278
 
276
279
  for (const game of games) {
277
280
  console.log(game.id);
278
- console.log(game.coinType);
281
+ console.log(game.coin_type);
279
282
  }
280
283
  ```
281
284
 
@@ -460,7 +463,7 @@ These are generated Move event decoders. Use them to parse Suigar event payloads
460
463
  - `fromMoveFloat(float)` converts a generated Move `Float` struct to a JavaScript number
461
464
  - `parseCoinType(type)` extracts the normalized coin type from generic Move object type strings such as PvP coinflip `Game<T>`
462
465
  and throws `TypeError` when the type string does not include a first generic coin type
463
- - `parseGameDetails(game_details)` decodes `BetResultEvent.game_details` entries into the expected string, number, and boolean values
466
+ - `parseGameDetails(gameId, game_details)` decodes `BetResultEvent.game_details` entries into the expected string, number, and boolean values
464
467
 
465
468
  ### Parse PvP Coinflip Game Object Data
466
469
 
@@ -525,17 +528,28 @@ Parsed fields include:
525
528
  - `game_details`
526
529
  - `metadata`
527
530
 
528
- `game_details` and `metadata` decode as `VecMap<string, vector<u8>>`-shaped data, so values come back as byte arrays. Use `parseGameDetails` from `@suigar/sdk/utils` to decode `game_details` with the SDK's known game-detail schemas.
531
+ `game_details` and `metadata` decode as `VecMap<string, vector<u8>>`-shaped data, so values come back as byte arrays. Use `parseGameEvent(event)` from `@suigar/sdk/utils` to retrieve the normalized `gameId` and `eventName`, then pass that `gameId` to `parseGameDetails(gameId, decoded.game_details)` for game-specific key and value typing.
529
532
 
530
533
  ```ts
531
- import { parseGameDetails } from '@suigar/sdk/utils';
534
+ import { parseGameDetails, parseGameEvent } from '@suigar/sdk/utils';
532
535
 
536
+ const { gameId, eventName } = parseGameEvent(event)!;
533
537
  const decoded = client.suigar.bcs.BetResultEvent.parse(event.bcs);
534
- const gameDetails = parseGameDetails(decoded.game_details);
538
+ const gameDetails = parseGameDetails(gameId, decoded.game_details);
535
539
  ```
536
540
 
537
541
  `parseGameDetails` preserves the on-chain keys and only changes the value representation. For example, coinflip details keep keys such as `player_bet` and `coin_outcome`; range details keep keys such as `roll_value`, `win`, and `payout_multiplier`.
538
542
 
543
+ `parseGameDetails(gameId, decoded.game_details)` narrows based on the parsed event game id. For example, when `gameId === 'coinflip'` it narrows to:
544
+
545
+ - `{ player_bet: string; coin_outcome: string }`
546
+
547
+ `parseGameEvent(event)` returns the normalized game id and raw Move event name for every supported Suigar event in `GAME_EVENTS`:
548
+
549
+ - `{ gameId: 'coinflip' | 'limbo' | 'plinko' | 'range' | 'wheel', eventName: 'BetResultEvent' }` for standard bet result events
550
+ - `{ gameId: 'pvp-coinflip', eventName: 'GameCreatedEvent' | 'GameResolvedEvent' | 'GameCancelledEvent' }` for PvP coinflip events
551
+ - `null` for unsupported event names or non-Suigar event payloads
552
+
539
553
  When the extension is configured with `partner`, decoded event `metadata` will
540
554
  contain that partner wallet address under the `partner` entry.
541
555
 
@@ -545,7 +559,7 @@ contain that partner wallet address under the `partner` entry.
545
559
  > - unwrap the core API union with `result.$kind`, `result.Transaction`, and `result.FailedTransaction`
546
560
  > - parse emitted events from the unwrapped transaction result
547
561
  > - use `event.bcs` for consistent decoding across transports
548
- > - use `parseGameDetails(decoded.game_details)` instead of hand-decoding standard game detail byte arrays
562
+ > - use `const { gameId } = parseGameEvent(event)!` and then `parseGameDetails(gameId, decoded.game_details)` instead of hand-decoding standard game detail byte arrays
549
563
 
550
564
  > **Tip:**
551
565
  >
@@ -0,0 +1,258 @@
1
+ import { Game, StandardGame } from "./types/game.type.mjs";
2
+ import { SuigarConfig, SuigarExtensionOptions } from "./types/suigar-config.type.mjs";
3
+ import { BuildPvPCoinflipTransactionOptions, PvPCoinflipAction, WithThrowOnError } from "./types/transaction-options.type.mjs";
4
+ import { MoveStruct } from "./contracts/utils/index.mjs";
5
+ import { Game as Game$1 } from "./contracts/pvp-coinflip/pvp_coinflip.mjs";
6
+ import { BuildGameOptions } from "./types/build-game-transaction-options.type.mjs";
7
+ import { GameParameters, GetGameParametersOptions } from "./types/game-settings.type.mjs";
8
+ import { BuildTransactionOptions, Transaction } from "@mysten/sui/transactions";
9
+ import { ClientWithCoreApi, SuiClientTypes } from "@mysten/sui/client";
10
+ import * as _$_mysten_bcs0 from "@mysten/bcs";
11
+ import { InferBcsType } from "@mysten/bcs";
12
+
13
+ //#region src/client.d.ts
14
+ declare function suigar<const Name = 'suigar'>({
15
+ name,
16
+ partner,
17
+ cacheTtl
18
+ }?: SuigarExtensionOptions<Name>): {
19
+ name: Name;
20
+ register: (client: ClientWithCoreApi) => SuigarClient;
21
+ };
22
+ declare class SuigarClient {
23
+ #private;
24
+ constructor({
25
+ client,
26
+ name,
27
+ partner,
28
+ cacheTtl
29
+ }: {
30
+ client: ClientWithCoreApi;
31
+ name: string;
32
+ partner?: string;
33
+ cacheTtl?: number;
34
+ });
35
+ /**
36
+ * Returns the resolved SDK configuration for the connected network.
37
+ *
38
+ * This is primarily useful for debugging or inspecting which package ids,
39
+ * registry ids, supported coin types, and price info object ids the SDK
40
+ * resolved for the current client network.
41
+ *
42
+ * @returns Network-resolved Suigar configuration.
43
+ */
44
+ getConfig(): SuigarConfig;
45
+ /**
46
+ * Builds a transaction with the configured Sui client and encodes the resulting BCS bytes as base64.
47
+ *
48
+ * Use this when an external wallet, API, or transport expects the built transaction payload as a base64 string
49
+ * instead of raw bytes. The SDK always injects the configured Sui client, so `options` accepts the standard
50
+ * transaction build options except for `client`.
51
+ *
52
+ * @param transaction Transaction to build and serialize.
53
+ * @param options Optional transaction build options forwarded to `transaction.build()`, excluding `client`.
54
+ * @returns Base64-encoded transaction bytes ready to send over the wire.
55
+ */
56
+ serializeTransactionToBase64(transaction: Transaction, options?: Omit<BuildTransactionOptions, 'client'>): Promise<string>;
57
+ /**
58
+ * Reads on-chain game parameters for the requested game.
59
+ *
60
+ * The SDK first reads the selected game's settings object from SweetHouse,
61
+ * then reads that game's coin-specific `Parameters<T>` object. Results are
62
+ * cached according to the extension `cacheTtl` option. Pass
63
+ * `ignoreCache: true` to refresh the on-chain read and replace the cached
64
+ * value.
65
+ *
66
+ * @param game Game whose parameters should be loaded.
67
+ * @param options Optional coin type, cache override, and abort signal.
68
+ * @returns Parsed game parameters typed for the requested game.
69
+ */
70
+ getGameParameters<TGame extends Game>(game: TGame, options?: GetGameParametersOptions): Promise<GameParameters<TGame>>;
71
+ /**
72
+ * Lists unresolved PvP coinflip games from the configured registry and resolves
73
+ * each entry into parsed on-chain game state.
74
+ *
75
+ * This fetches dynamic fields from the PvP coinflip registry object, then bulk
76
+ * loads the referenced game objects through `client.core.getObjects()`. Registry
77
+ * membership is the unresolved-state signal: when a game is joined and resolved,
78
+ * the Move flow removes it from the registry and deletes the live `Game` object.
79
+ * Use this when a product needs the current set of open PvP coinflip matches for
80
+ * browsing or lobby views.
81
+ *
82
+ * @param options Optional dynamic field pagination forwarded to `listDynamicFields()`, excluding `parentId`.
83
+ * Supported options such as `limit`, `cursor`, and `signal` are forwarded to the
84
+ * underlying lookup calls. Pass `throwOnError: true` to fail the whole lookup
85
+ * when any referenced game object cannot be fetched or parsed. By default,
86
+ * failed per-object lookups are skipped and only successfully parsed unresolved
87
+ * games are returned.
88
+ * @returns Parsed unresolved PvP coinflip game objects for the requested
89
+ * registry page. When `throwOnError` is `false`, entries that fail object fetch
90
+ * or parse are omitted from the returned array.
91
+ */
92
+ getPvPCoinflipGames(options?: WithThrowOnError<Omit<SuiClientTypes.ListDynamicFieldsOptions, 'parentId'>>): Promise<(InferBcsType<typeof Game$1> & {
93
+ coin_type: string;
94
+ })[]>;
95
+ /**
96
+ * BCS struct constructors for decoding on-chain objects and events related to Suigar games.
97
+ *
98
+ * These can be used to parse the `content` field of on-chain objects and events into structured data with the
99
+ * expected types. For example, use `client.suigar.bcs.PvPCoinflipGame.parse(object.content)` to decode a PvP
100
+ * coinflip game object.
101
+ *
102
+ * Note that these constructors are not meant for encoding transaction arguments, as the SDK's transaction
103
+ * builders handle argument serialization internally. Use these primarily for decoding and parsing on-chain data.
104
+ */
105
+ bcs: {
106
+ /**
107
+ * Object representing the state of a PvP coinflip game, as stored on-chain.
108
+ */
109
+ PvPCoinflipGame: MoveStruct<{
110
+ id: _$_mysten_bcs0.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
111
+ creator: _$_mysten_bcs0.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
112
+ creator_is_tails: _$_mysten_bcs0.BcsType<boolean, boolean, "bool">;
113
+ is_private: _$_mysten_bcs0.BcsType<boolean, boolean, "bool">;
114
+ creator_metadata: MoveStruct<{
115
+ contents: _$_mysten_bcs0.BcsType<{
116
+ key: string;
117
+ value: number[];
118
+ }[], Iterable<{
119
+ key: string;
120
+ value: Iterable<number> & {
121
+ length: number;
122
+ };
123
+ }> & {
124
+ length: number;
125
+ }, string>;
126
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
127
+ joiner: _$_mysten_bcs0.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
128
+ winner: _$_mysten_bcs0.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
129
+ stake_per_player: _$_mysten_bcs0.BcsType<string, string | number | bigint, "u64">;
130
+ house_edge_bps: _$_mysten_bcs0.BcsType<string, string | number | bigint, "u64">;
131
+ stake_pot: MoveStruct<{
132
+ value: _$_mysten_bcs0.BcsType<string, string | number | bigint, "u64">;
133
+ }, "0x2::balance::Balance<phantom T0>">;
134
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::Game<phantom T0>">;
135
+ /**
136
+ * Event emitted at the end of a standard game (e.g., Coinflip, Limbo), containing the result and payout information.
137
+ */
138
+ BetResultEvent: MoveStruct<{
139
+ player: _$_mysten_bcs0.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
140
+ coin_type: MoveStruct<{
141
+ name: _$_mysten_bcs0.BcsType<string, string, "string">;
142
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
143
+ stake_amount: _$_mysten_bcs0.BcsType<string, string | number | bigint, "u64">;
144
+ unsafe_oracle_usd_coin_price: MoveStruct<{
145
+ is_negative: _$_mysten_bcs0.BcsType<boolean, boolean, "bool">;
146
+ exp: MoveStruct<{
147
+ bits: _$_mysten_bcs0.BcsType<string, string | number | bigint, "u64">;
148
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
149
+ mant: _$_mysten_bcs0.BcsType<string, string | number | bigint, "u64">;
150
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
151
+ adjusted_oracle_usd_coin_price: MoveStruct<{
152
+ is_negative: _$_mysten_bcs0.BcsType<boolean, boolean, "bool">;
153
+ exp: MoveStruct<{
154
+ bits: _$_mysten_bcs0.BcsType<string, string | number | bigint, "u64">;
155
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
156
+ mant: _$_mysten_bcs0.BcsType<string, string | number | bigint, "u64">;
157
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
158
+ outcome_amount: _$_mysten_bcs0.BcsType<string, string | number | bigint, "u64">;
159
+ game_details: MoveStruct<{
160
+ contents: _$_mysten_bcs0.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
+ metadata: MoveStruct<{
173
+ contents: _$_mysten_bcs0.BcsType<{
174
+ key: string;
175
+ value: number[];
176
+ }[], Iterable<{
177
+ key: string;
178
+ value: Iterable<number> & {
179
+ length: number;
180
+ };
181
+ }> & {
182
+ length: number;
183
+ }, string>;
184
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
185
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::core::BetResultEvent<phantom T0>">;
186
+ /**
187
+ * Event emitted when a PvP Coinflip game is created, containing the game configuration and initial state.
188
+ */
189
+ PvPCoinflipGameCreatedEvent: MoveStruct<{
190
+ game_id: _$_mysten_bcs0.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
191
+ creator: _$_mysten_bcs0.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
192
+ creator_is_tails: _$_mysten_bcs0.BcsType<boolean, boolean, "bool">;
193
+ is_private: _$_mysten_bcs0.BcsType<boolean, boolean, "bool">;
194
+ joiner_is_tails: _$_mysten_bcs0.BcsType<boolean, boolean, "bool">;
195
+ stake_per_player: _$_mysten_bcs0.BcsType<string, string | number | bigint, "u64">;
196
+ house_edge_bps: _$_mysten_bcs0.BcsType<string, string | number | bigint, "u64">;
197
+ coin_type: MoveStruct<{
198
+ name: _$_mysten_bcs0.BcsType<string, string, "string">;
199
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
200
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCreatedEvent<phantom T0>">;
201
+ /**
202
+ * Event emitted when a PvP Coinflip game is resolved, containing the final outcome.
203
+ */
204
+ PvPCoinflipGameResolvedEvent: MoveStruct<{
205
+ game_id: _$_mysten_bcs0.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
206
+ creator: _$_mysten_bcs0.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
207
+ joiner: _$_mysten_bcs0.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
208
+ winner: _$_mysten_bcs0.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
209
+ creator_is_tails: _$_mysten_bcs0.BcsType<boolean, boolean, "bool">;
210
+ is_private: _$_mysten_bcs0.BcsType<boolean, boolean, "bool">;
211
+ joiner_is_tails: _$_mysten_bcs0.BcsType<boolean, boolean, "bool">;
212
+ stake_per_player: _$_mysten_bcs0.BcsType<string, string | number | bigint, "u64">;
213
+ total_pot: _$_mysten_bcs0.BcsType<string, string | number | bigint, "u64">;
214
+ house_edge_amount: _$_mysten_bcs0.BcsType<string, string | number | bigint, "u64">;
215
+ payout_amount: _$_mysten_bcs0.BcsType<string, string | number | bigint, "u64">;
216
+ coin_type: MoveStruct<{
217
+ name: _$_mysten_bcs0.BcsType<string, string, "string">;
218
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
219
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameResolvedEvent<phantom T0>">;
220
+ /**
221
+ * Event emitted when a PvP Coinflip game is cancelled.
222
+ */
223
+ PvPCoinflipGameCancelledEvent: MoveStruct<{
224
+ game_id: _$_mysten_bcs0.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
225
+ creator: _$_mysten_bcs0.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
226
+ creator_is_tails: _$_mysten_bcs0.BcsType<boolean, boolean, "bool">;
227
+ is_private: _$_mysten_bcs0.BcsType<boolean, boolean, "bool">;
228
+ stake_per_player: _$_mysten_bcs0.BcsType<string, string | number | bigint, "u64">;
229
+ coin_type: MoveStruct<{
230
+ name: _$_mysten_bcs0.BcsType<string, string, "string">;
231
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
232
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCancelledEvent<phantom T0>">;
233
+ };
234
+ /**
235
+ * Transaction builders for Suigar games.
236
+ */
237
+ tx: {
238
+ /**
239
+ * Creates a standard game transaction for the provided game id.
240
+ *
241
+ * @param gameId Supported standard game identifier.
242
+ * @param options Transaction builder options for the selected game.
243
+ * @returns Prepared transaction for the selected game.
244
+ */
245
+ createBetTransaction: <GameId extends StandardGame>(gameId: GameId, options: BuildGameOptions<GameId>) => Transaction;
246
+ /**
247
+ * Creates a PvP coinflip transaction for the requested action.
248
+ *
249
+ * @param action PvP coinflip action to perform.
250
+ * @param options Transaction builder options for the selected action.
251
+ * @returns Prepared PvP coinflip transaction.
252
+ */
253
+ createPvPCoinflipTransaction: <Action extends PvPCoinflipAction>(action: Action, options: BuildPvPCoinflipTransactionOptions<Action>) => Transaction;
254
+ };
255
+ }
256
+ //#endregion
257
+ export { SuigarClient, suigar };
258
+ //# sourceMappingURL=client.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.mts","names":[],"sources":["../src/client.ts"],"mappings":";;;;;;;;;;;;;iBA+DgB,MAAA,uBAAA,CAAA;EACf,IAAA;EACA,OAAA;EACA;AAAA,IACE,sBAAA,CAAuB,IAAA;;qBAGL,iBAAA,KAAoB,YAAA;AAAA;AAAA,cAW5B,YAAA;EAAA;;IAUX,MAAA;IACA,IAAA;IACA,OAAA;IACA;EAAA;IAEA,MAAA,EAAQ,iBAAA;IACR,IAAA;IACA,OAAA;IACA,QAAA;EAAA;EAlCD;;;;;;;;;EA+DA,SAAA,CAAA,GAAa,YAAA;EAhEb;;;;;;;;;;;EA+EM,4BAAA,CACL,WAAA,EAAa,WAAA,EACb,OAAA,GAAU,IAAA,CAAK,uBAAA,cACb,OAAA;;;;;AAjEJ;;;;;;;;;EAmFO,iBAAA,eAAgC,IAAA,CAAA,CACrC,IAAA,EAAM,KAAA,EACN,OAAA,GAAS,wBAAA,GACP,OAAA,CAAQ,cAAA,CAAe,KAAA;EAtBV;;;;;;;;;;;;;;;;;;;;;EAsDV,mBAAA,CACL,OAAA,GAAS,gBAAA,CACR,IAAA,CAAK,cAAA,CAAe,wBAAA,iBAInB,OAAA,EAAS,YAAA,QAAoB,MAAA;IAAqB,SAAA;EAAA;;;;;;;;;;;EA4DrD,GAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsCW;;;;;;;;;;;;;;;IAlNV;;;;;;;;;;;;;;;;;;;IAuEuB;;;;;;;;;;;;;;EAoCvB;;;EA6FD,EAAA;IAxFqD;;;;;;;0CAgGd,YAAA,EAAY,MAAA,EACzC,MAAA,EAAM,OAAA,EACL,gBAAA,CAAiB,MAAA,MACxB,WAAA;;;;;;;;kDA2C2C,iBAAA,EAAiB,MAAA,EACtD,MAAA,EAAM,OAAA,EACL,kCAAA,CAAmC,MAAA,MAC1C,WAAA;EAAA;AAAA"}