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

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 (147) hide show
  1. package/CHANGELOG.md +165 -1
  2. package/README.md +300 -59
  3. package/dist/client.d.mts +257 -0
  4. package/dist/client.d.mts.map +1 -0
  5. package/dist/client.mjs +278 -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 +54 -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 +13 -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 +33 -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 +68 -0
  66. package/dist/contracts/utils/index.d.mts.map +1 -0
  67. package/dist/contracts/utils/index.mjs +185 -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 +72 -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 +200 -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 +80 -82
  144. package/dist/index.cjs +0 -1016
  145. package/dist/index.d.cts +0 -267
  146. package/dist/index.d.ts +0 -267
  147. package/dist/index.js +0 -1014
@@ -0,0 +1,257 @@
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 { GameParameters, GetGameParametersOptions } from "./types/game-settings.type.mjs";
7
+ import { BuildGameOptions } from "./types/build-game-transaction-options.type.mjs";
8
+ import { BuildTransactionOptions, Transaction } from "@mysten/sui/transactions";
9
+ import { ClientWithCoreApi, SuiClientTypes } from "@mysten/sui/client";
10
+ import { InferBcsType } from "@mysten/bcs";
11
+
12
+ //#region src/client.d.ts
13
+ declare function suigar<const Name = 'suigar'>({
14
+ name,
15
+ partner,
16
+ cacheTtl
17
+ }?: SuigarExtensionOptions<Name>): {
18
+ name: Name;
19
+ register: (client: ClientWithCoreApi) => SuigarClient;
20
+ };
21
+ declare class SuigarClient {
22
+ #private;
23
+ constructor({
24
+ client,
25
+ name,
26
+ partner,
27
+ cacheTtl
28
+ }: {
29
+ client: ClientWithCoreApi;
30
+ name: string;
31
+ partner?: string;
32
+ cacheTtl?: number;
33
+ });
34
+ /**
35
+ * Returns the resolved SDK configuration for the connected network.
36
+ *
37
+ * This is primarily useful for debugging or inspecting which package ids,
38
+ * registry ids, supported coin types, and price info object ids the SDK
39
+ * resolved for the current client network.
40
+ *
41
+ * @returns Network-resolved Suigar configuration.
42
+ */
43
+ getConfig(): SuigarConfig;
44
+ /**
45
+ * Builds a transaction with the configured Sui client and encodes the resulting BCS bytes as base64.
46
+ *
47
+ * Use this when an external wallet, API, or transport expects the built transaction payload as a base64 string
48
+ * instead of raw bytes. The SDK always injects the configured Sui client, so `options` accepts the standard
49
+ * transaction build options except for `client`.
50
+ *
51
+ * @param transaction Transaction to build and serialize.
52
+ * @param options Optional transaction build options forwarded to `transaction.build()`, excluding `client`.
53
+ * @returns Base64-encoded transaction bytes ready to send over the wire.
54
+ */
55
+ serializeTransactionToBase64(transaction: Transaction, options?: Omit<BuildTransactionOptions, 'client'>): Promise<string>;
56
+ /**
57
+ * Reads on-chain game parameters for the requested game.
58
+ *
59
+ * The SDK first reads the selected game's settings object from SweetHouse,
60
+ * then reads that game's coin-specific `Parameters<T>` object. Results are
61
+ * cached according to the extension `cacheTtl` option. Pass
62
+ * `ignoreCache: true` to refresh the on-chain read and replace the cached
63
+ * value.
64
+ *
65
+ * @param game Game whose parameters should be loaded.
66
+ * @param options Optional coin type, cache override, and abort signal.
67
+ * @returns Parsed game parameters typed for the requested game.
68
+ */
69
+ getGameParameters<TGame extends Game>(game: TGame, options?: GetGameParametersOptions): Promise<GameParameters<TGame>>;
70
+ /**
71
+ * Lists unresolved PvP coinflip games from the configured registry and resolves
72
+ * each entry into parsed on-chain game state.
73
+ *
74
+ * This fetches dynamic fields from the PvP coinflip registry object, then bulk
75
+ * loads the referenced game objects through `client.core.getObjects()`. Registry
76
+ * membership is the unresolved-state signal: when a game is joined and resolved,
77
+ * the Move flow removes it from the registry and deletes the live `Game` object.
78
+ * Use this when a product needs the current set of open PvP coinflip matches for
79
+ * browsing or lobby views.
80
+ *
81
+ * @param options Optional dynamic field pagination forwarded to `listDynamicFields()`, excluding `parentId`.
82
+ * Supported options such as `limit`, `cursor`, and `signal` are forwarded to the
83
+ * underlying lookup calls. Pass `throwOnError: true` to fail the whole lookup
84
+ * when any referenced game object cannot be fetched or parsed. By default,
85
+ * failed per-object lookups are skipped and only successfully parsed unresolved
86
+ * games are returned.
87
+ * @returns Parsed unresolved PvP coinflip game objects for the requested
88
+ * registry page. When `throwOnError` is `false`, entries that fail object fetch
89
+ * or parse are omitted from the returned array.
90
+ */
91
+ getPvPCoinflipGames(options?: WithThrowOnError<Omit<SuiClientTypes.ListDynamicFieldsOptions, 'parentId'>>): Promise<(InferBcsType<typeof Game$1> & {
92
+ coin_type: string;
93
+ })[]>;
94
+ /**
95
+ * BCS struct constructors for decoding on-chain objects and events related to Suigar games.
96
+ *
97
+ * These can be used to parse the `content` field of on-chain objects and events into structured data with the
98
+ * expected types. For example, use `client.suigar.bcs.PvPCoinflipGame.parse(object.content)` to decode a PvP
99
+ * coinflip game object.
100
+ *
101
+ * Note that these constructors are not meant for encoding transaction arguments, as the SDK's transaction
102
+ * builders handle argument serialization internally. Use these primarily for decoding and parsing on-chain data.
103
+ */
104
+ bcs: {
105
+ /**
106
+ * Object representing the state of a PvP coinflip game, as stored on-chain.
107
+ */
108
+ PvPCoinflipGame: MoveStruct<{
109
+ id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
110
+ creator: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
111
+ creator_is_tails: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
112
+ is_private: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
113
+ creator_metadata: MoveStruct<{
114
+ contents: import("@mysten/bcs").BcsType<{
115
+ key: string;
116
+ value: number[];
117
+ }[], Iterable<{
118
+ key: string;
119
+ value: Iterable<number> & {
120
+ length: number;
121
+ };
122
+ }> & {
123
+ length: number;
124
+ }, string>;
125
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
126
+ joiner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
127
+ winner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
128
+ stake_per_player: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
129
+ house_edge_bps: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
130
+ stake_pot: MoveStruct<{
131
+ value: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
132
+ }, "0x2::balance::Balance<phantom T0>">;
133
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::Game<phantom T0>">;
134
+ /**
135
+ * Event emitted at the end of a standard game (e.g., Coinflip, Limbo), containing the result and payout information.
136
+ */
137
+ BetResultEvent: MoveStruct<{
138
+ player: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
139
+ coin_type: MoveStruct<{
140
+ name: import("@mysten/bcs").BcsType<string, string, "string">;
141
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
142
+ stake_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
143
+ unsafe_oracle_usd_coin_price: MoveStruct<{
144
+ is_negative: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
145
+ exp: MoveStruct<{
146
+ bits: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
147
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
148
+ mant: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
149
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
150
+ adjusted_oracle_usd_coin_price: MoveStruct<{
151
+ is_negative: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
152
+ exp: MoveStruct<{
153
+ bits: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
154
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
155
+ mant: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
156
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
157
+ outcome_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
158
+ game_details: MoveStruct<{
159
+ contents: import("@mysten/bcs").BcsType<{
160
+ key: string;
161
+ value: number[];
162
+ }[], Iterable<{
163
+ key: string;
164
+ value: Iterable<number> & {
165
+ length: number;
166
+ };
167
+ }> & {
168
+ length: number;
169
+ }, string>;
170
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
171
+ metadata: MoveStruct<{
172
+ contents: import("@mysten/bcs").BcsType<{
173
+ key: string;
174
+ value: number[];
175
+ }[], Iterable<{
176
+ key: string;
177
+ value: Iterable<number> & {
178
+ length: number;
179
+ };
180
+ }> & {
181
+ length: number;
182
+ }, string>;
183
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
184
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::core::BetResultEvent<phantom T0>">;
185
+ /**
186
+ * Event emitted when a PvP Coinflip game is created, containing the game configuration and initial state.
187
+ */
188
+ PvPCoinflipGameCreatedEvent: MoveStruct<{
189
+ game_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
190
+ creator: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
191
+ creator_is_tails: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
192
+ is_private: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
193
+ joiner_is_tails: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
194
+ stake_per_player: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
195
+ house_edge_bps: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
196
+ coin_type: MoveStruct<{
197
+ name: import("@mysten/bcs").BcsType<string, string, "string">;
198
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
199
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCreatedEvent<phantom T0>">;
200
+ /**
201
+ * Event emitted when a PvP Coinflip game is resolved, containing the final outcome.
202
+ */
203
+ PvPCoinflipGameResolvedEvent: MoveStruct<{
204
+ game_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
205
+ creator: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
206
+ joiner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
207
+ winner: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
208
+ creator_is_tails: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
209
+ is_private: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
210
+ joiner_is_tails: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
211
+ stake_per_player: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
212
+ total_pot: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
213
+ house_edge_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
214
+ payout_amount: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
215
+ coin_type: MoveStruct<{
216
+ name: import("@mysten/bcs").BcsType<string, string, "string">;
217
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
218
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameResolvedEvent<phantom T0>">;
219
+ /**
220
+ * Event emitted when a PvP Coinflip game is cancelled.
221
+ */
222
+ PvPCoinflipGameCancelledEvent: MoveStruct<{
223
+ game_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
224
+ creator: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
225
+ creator_is_tails: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
226
+ is_private: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
227
+ stake_per_player: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
228
+ coin_type: MoveStruct<{
229
+ name: import("@mysten/bcs").BcsType<string, string, "string">;
230
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
231
+ }, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::GameCancelledEvent<phantom T0>">;
232
+ };
233
+ /**
234
+ * Transaction builders for Suigar games.
235
+ */
236
+ tx: {
237
+ /**
238
+ * Creates a standard game transaction for the provided game id.
239
+ *
240
+ * @param gameId Supported standard game identifier.
241
+ * @param options Transaction builder options for the selected game.
242
+ * @returns Prepared transaction for the selected game.
243
+ */
244
+ createBetTransaction: <GameId extends StandardGame>(gameId: GameId, options: BuildGameOptions<GameId>) => Transaction;
245
+ /**
246
+ * Creates a PvP coinflip transaction for the requested action.
247
+ *
248
+ * @param action PvP coinflip action to perform.
249
+ * @param options Transaction builder options for the selected action.
250
+ * @returns Prepared PvP coinflip transaction.
251
+ */
252
+ createPvPCoinflipTransaction: <Action extends PvPCoinflipAction>(action: Action, options: BuildPvPCoinflipTransactionOptions<Action>) => Transaction;
253
+ };
254
+ }
255
+ //#endregion
256
+ export { SuigarClient, suigar };
257
+ //# sourceMappingURL=client.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.mts","names":[],"sources":["../src/client.ts"],"mappings":";;;;;;;;;;;;iBA+DgB,MAAA;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;EAjCD;;;;;;;;;EA8DA,SAAA,IAAa,YAAA;EAhEb;;;;;;;;;;;EA+EM,4BAAA,CACL,WAAA,EAAa,WAAA,EACb,OAAA,GAAU,IAAA,CAAK,uBAAA,cACb,OAAA;EA5EqC;;AAAY;AAWrD;;;;;;;;;;EAmFO,iBAAA,eAAgC,IAAA,EACrC,IAAA,EAAM,KAAA,EACN,OAAA,GAAS,wBAAA,GACP,OAAA,CAAQ,cAAA,CAAe,KAAA;EAtBf;;;;;;;;;;;;;;;;;;;;;EAsDL,mBAAA,CACL,OAAA,GAAS,gBAAA,CACR,IAAA,CAAK,cAAA,CAAe,wBAAA,iBAInB,OAAA,EAAS,YAAA,QAAoB,MAAA;IAAqB,SAAA;EAAA;;;;;;;;;;;EA4DrD,GAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqCU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAjGP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwFH,EAAA;;;;;;;;0CAQuC,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"}
@@ -0,0 +1,278 @@
1
+ import { TypeName } from "./contracts/core/deps/0x0000000000000000000000000000000000000000000000000000000000000001/type_name.mjs";
2
+ import { BetResultEvent } from "./contracts/core/core.mjs";
3
+ import { Game, GameCancelledEvent, GameCreatedEvent, GameResolvedEvent } from "./contracts/pvp-coinflip/pvp_coinflip.mjs";
4
+ import { resolveGamePackageId, resolveSuigarConfig } from "./helpers/config.mjs";
5
+ import { resolveCoinTypeNameForTypeNameKey, resolveGameSettingsKeyType } from "./helpers/game-settings.mjs";
6
+ import { SUPPORTED_SUI_NETWORKS } from "./types/network.type.mjs";
7
+ import { parseCoinType } from "./utils/parser.mjs";
8
+ import { buildCoinflipTransaction } from "./transactions/coinflip.mjs";
9
+ import { buildLimboTransaction } from "./transactions/limbo.mjs";
10
+ import { buildPlinkoTransaction } from "./transactions/plinko.mjs";
11
+ import { buildPvPCoinflipTransaction } from "./transactions/pvp-coinflip.mjs";
12
+ import { buildRangeTransaction } from "./transactions/range.mjs";
13
+ import { buildWheelTransaction } from "./transactions/wheel.mjs";
14
+ import { TtlClientCache } from "./ttl-cache.mjs";
15
+ import { GAME_SETTINGS } from "./types/game-settings.type.mjs";
16
+ import { normalizeStructTag, toBase64 } from "@mysten/sui/utils";
17
+ //#region src/client.ts
18
+ function suigar({ name = "suigar", partner, cacheTtl } = {}) {
19
+ return {
20
+ name,
21
+ register: (client) => {
22
+ return new SuigarClient({
23
+ client,
24
+ name: String(name),
25
+ partner,
26
+ cacheTtl
27
+ });
28
+ }
29
+ };
30
+ }
31
+ var SuigarClient = class {
32
+ #client;
33
+ #config;
34
+ #partner;
35
+ #cache;
36
+ constructor({ client, name, partner, cacheTtl }) {
37
+ this.bcs = {
38
+ /**
39
+ * Object representing the state of a PvP coinflip game, as stored on-chain.
40
+ */
41
+ PvPCoinflipGame: Game,
42
+ /**
43
+ * Event emitted at the end of a standard game (e.g., Coinflip, Limbo), containing the result and payout information.
44
+ */
45
+ BetResultEvent,
46
+ /**
47
+ * Event emitted when a PvP Coinflip game is created, containing the game configuration and initial state.
48
+ */
49
+ PvPCoinflipGameCreatedEvent: GameCreatedEvent,
50
+ /**
51
+ * Event emitted when a PvP Coinflip game is resolved, containing the final outcome.
52
+ */
53
+ PvPCoinflipGameResolvedEvent: GameResolvedEvent,
54
+ /**
55
+ * Event emitted when a PvP Coinflip game is cancelled.
56
+ */
57
+ PvPCoinflipGameCancelledEvent: GameCancelledEvent
58
+ };
59
+ this.tx = {
60
+ /**
61
+ * Creates a standard game transaction for the provided game id.
62
+ *
63
+ * @param gameId Supported standard game identifier.
64
+ * @param options Transaction builder options for the selected game.
65
+ * @returns Prepared transaction for the selected game.
66
+ */
67
+ createBetTransaction: (gameId, options) => {
68
+ switch (gameId) {
69
+ case "coinflip": return buildCoinflipTransaction({
70
+ ...options,
71
+ config: this.#config,
72
+ partner: this.#partner
73
+ });
74
+ case "limbo": return buildLimboTransaction({
75
+ ...options,
76
+ config: this.#config,
77
+ partner: this.#partner
78
+ });
79
+ case "plinko": return buildPlinkoTransaction({
80
+ ...options,
81
+ config: this.#config,
82
+ partner: this.#partner
83
+ });
84
+ case "range": return buildRangeTransaction({
85
+ ...options,
86
+ config: this.#config,
87
+ partner: this.#partner
88
+ });
89
+ case "wheel": return buildWheelTransaction({
90
+ ...options,
91
+ config: this.#config,
92
+ partner: this.#partner
93
+ });
94
+ default: throw new RangeError(`Unsupported game: ${gameId}`);
95
+ }
96
+ },
97
+ /**
98
+ * Creates a PvP coinflip transaction for the requested action.
99
+ *
100
+ * @param action PvP coinflip action to perform.
101
+ * @param options Transaction builder options for the selected action.
102
+ * @returns Prepared PvP coinflip transaction.
103
+ */
104
+ createPvPCoinflipTransaction: (action, options) => {
105
+ switch (action) {
106
+ case "create": return buildPvPCoinflipTransaction("create", {
107
+ ...options,
108
+ config: this.#config,
109
+ partner: this.#partner
110
+ });
111
+ case "join": {
112
+ const joinOptions = options;
113
+ return buildPvPCoinflipTransaction("join", {
114
+ ...joinOptions,
115
+ betCoin: this.#createPvPCoinflipBetCoin(joinOptions),
116
+ config: this.#config,
117
+ partner: this.#partner
118
+ });
119
+ }
120
+ case "cancel": return buildPvPCoinflipTransaction("cancel", {
121
+ ...options,
122
+ config: this.#config,
123
+ partner: this.#partner
124
+ });
125
+ default: throw new RangeError(`Unsupported PvP coinflip action: ${action}`);
126
+ }
127
+ }
128
+ };
129
+ this.#client = client;
130
+ this.#partner = partner;
131
+ this.#cache = client.cache.scope("@suigar/sdk").readSync([name, "ttl-cache"], () => {
132
+ return new TtlClientCache({ ttlMs: cacheTtl ?? 18e5 });
133
+ });
134
+ const network = this.#client.network;
135
+ if (!SUPPORTED_SUI_NETWORKS.includes(network)) throw new RangeError(`Unsupported network: ${network}`);
136
+ this.#config = resolveSuigarConfig(network);
137
+ }
138
+ /**
139
+ * Returns the resolved SDK configuration for the connected network.
140
+ *
141
+ * This is primarily useful for debugging or inspecting which package ids,
142
+ * registry ids, supported coin types, and price info object ids the SDK
143
+ * resolved for the current client network.
144
+ *
145
+ * @returns Network-resolved Suigar configuration.
146
+ */
147
+ getConfig() {
148
+ return this.#config;
149
+ }
150
+ /**
151
+ * Builds a transaction with the configured Sui client and encodes the resulting BCS bytes as base64.
152
+ *
153
+ * Use this when an external wallet, API, or transport expects the built transaction payload as a base64 string
154
+ * instead of raw bytes. The SDK always injects the configured Sui client, so `options` accepts the standard
155
+ * transaction build options except for `client`.
156
+ *
157
+ * @param transaction Transaction to build and serialize.
158
+ * @param options Optional transaction build options forwarded to `transaction.build()`, excluding `client`.
159
+ * @returns Base64-encoded transaction bytes ready to send over the wire.
160
+ */
161
+ async serializeTransactionToBase64(transaction, options) {
162
+ return toBase64(await transaction.build({
163
+ ...options,
164
+ client: this.#client
165
+ }));
166
+ }
167
+ /**
168
+ * Reads on-chain game parameters for the requested game.
169
+ *
170
+ * The SDK first reads the selected game's settings object from SweetHouse,
171
+ * then reads that game's coin-specific `Parameters<T>` object. Results are
172
+ * cached according to the extension `cacheTtl` option. Pass
173
+ * `ignoreCache: true` to refresh the on-chain read and replace the cached
174
+ * value.
175
+ *
176
+ * @param game Game whose parameters should be loaded.
177
+ * @param options Optional coin type, cache override, and abort signal.
178
+ * @returns Parsed game parameters typed for the requested game.
179
+ */
180
+ async getGameParameters(game, options = {}) {
181
+ const coinType = normalizeStructTag(options.coinType ?? this.#config.coinTypes.sui);
182
+ return this.#cache.read([
183
+ "parameters",
184
+ this.#client.network,
185
+ game,
186
+ coinType
187
+ ], () => this.#fetchGameParameters(game, coinType, options.signal), { ignoreCache: options.ignoreCache });
188
+ }
189
+ /**
190
+ * Lists unresolved PvP coinflip games from the configured registry and resolves
191
+ * each entry into parsed on-chain game state.
192
+ *
193
+ * This fetches dynamic fields from the PvP coinflip registry object, then bulk
194
+ * loads the referenced game objects through `client.core.getObjects()`. Registry
195
+ * membership is the unresolved-state signal: when a game is joined and resolved,
196
+ * the Move flow removes it from the registry and deletes the live `Game` object.
197
+ * Use this when a product needs the current set of open PvP coinflip matches for
198
+ * browsing or lobby views.
199
+ *
200
+ * @param options Optional dynamic field pagination forwarded to `listDynamicFields()`, excluding `parentId`.
201
+ * Supported options such as `limit`, `cursor`, and `signal` are forwarded to the
202
+ * underlying lookup calls. Pass `throwOnError: true` to fail the whole lookup
203
+ * when any referenced game object cannot be fetched or parsed. By default,
204
+ * failed per-object lookups are skipped and only successfully parsed unresolved
205
+ * games are returned.
206
+ * @returns Parsed unresolved PvP coinflip game objects for the requested
207
+ * registry page. When `throwOnError` is `false`, entries that fail object fetch
208
+ * or parse are omitted from the returned array.
209
+ */
210
+ async getPvPCoinflipGames(options = { limit: 50 }) {
211
+ const { throwOnError = false, ...listOptions } = options;
212
+ const { dynamicFields } = await this.#client.core.listDynamicFields({
213
+ ...listOptions,
214
+ parentId: this.#config.registryIds.pvpCoinflip
215
+ });
216
+ const { objects } = await this.#client.core.getObjects({
217
+ objectIds: dynamicFields.map(({ childId }) => childId),
218
+ signal: listOptions.signal,
219
+ include: { content: true }
220
+ });
221
+ const resolvedGames = objects.map((object) => {
222
+ try {
223
+ if (object instanceof Error) throw object;
224
+ if (!object.content) throw new Error("Unable to resolve PvP coinflip game from retrieved object");
225
+ return {
226
+ ...Game.parse(object.content),
227
+ coin_type: parseCoinType(object.type)
228
+ };
229
+ } catch (error) {
230
+ return error instanceof Error ? error : new Error(String(error));
231
+ }
232
+ });
233
+ if (throwOnError) {
234
+ const firstError = resolvedGames.find((game) => game instanceof Error);
235
+ if (firstError) throw firstError;
236
+ }
237
+ return resolvedGames.flatMap((game) => game instanceof Error ? [] : [game]);
238
+ }
239
+ #createPvPCoinflipBetCoin(options) {
240
+ return async (tx) => {
241
+ const { json } = await Game.get({
242
+ client: this.#client,
243
+ objectId: options.gameId
244
+ });
245
+ return tx.coin({
246
+ type: options.coinType,
247
+ balance: BigInt(json.stake_per_player),
248
+ useGasCoin: options.allowGasCoinShortcut
249
+ });
250
+ };
251
+ }
252
+ async #fetchGameParameters(game, coinType, signal) {
253
+ const gameDefinition = GAME_SETTINGS[game];
254
+ const { object: settingsObject } = await this.#client.core.getDynamicObjectField({
255
+ parentId: this.#config.packageIds.sweetHouse,
256
+ name: {
257
+ type: resolveGameSettingsKeyType(gameDefinition.settingsKey.name, resolveGamePackageId(this.#config, game)),
258
+ bcs: gameDefinition.settingsKey.serialize({ dummy_field: false }).toBytes()
259
+ },
260
+ signal
261
+ });
262
+ const { object } = await this.#client.core.getDynamicObjectField({
263
+ parentId: settingsObject.objectId,
264
+ name: {
265
+ type: TypeName.name,
266
+ bcs: TypeName.serialize({ name: resolveCoinTypeNameForTypeNameKey(coinType) }).toBytes()
267
+ },
268
+ include: { content: true },
269
+ signal
270
+ });
271
+ if (!object?.content) throw new Error(`Missing parameters object content for ${game} and coin type ${coinType}`);
272
+ return gameDefinition.parameters.parse(object.content);
273
+ }
274
+ };
275
+ //#endregion
276
+ export { SuigarClient, suigar };
277
+
278
+ //# sourceMappingURL=client.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.mjs","names":["#config","#partner","#createPvPCoinflipBetCoin","#client","#cache","#fetchGameParameters","PvPCoinflipGame"],"sources":["../src/client.ts"],"sourcesContent":["// Copyright (c) Suigar\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { InferBcsType } from '@mysten/bcs';\nimport type { ClientWithCoreApi, SuiClientTypes } from '@mysten/sui/client';\nimport {\n\tBuildTransactionOptions,\n\tTransaction,\n\tTransactionResult,\n} from '@mysten/sui/transactions';\nimport { normalizeStructTag, toBase64 } from '@mysten/sui/utils';\nimport { BetResultEvent } from './contracts/core/core.js';\nimport { TypeName } from './contracts/core/deps/0x0000000000000000000000000000000000000000000000000000000000000001/type_name.js';\nimport {\n\tGame as PvPCoinflipGame,\n\tGameCancelledEvent as PvPCoinflipGameCancelledEvent,\n\tGameCreatedEvent as PvPCoinflipGameCreatedEvent,\n\tGameResolvedEvent as PvPCoinflipGameResolvedEvent,\n} from './contracts/pvp-coinflip/pvp_coinflip.js';\nimport {\n\tDEFAULT_CACHE_TTL_MS,\n\tresolveCoinTypeNameForTypeNameKey,\n\tresolveGamePackageId,\n\tresolveGameSettingsKeyType,\n\tresolveSuigarConfig,\n} from './helpers/index.js';\nimport {\n\tbuildCoinflipTransaction,\n\tbuildLimboTransaction,\n\tbuildPlinkoTransaction,\n\tbuildPvPCoinflipTransaction,\n\tbuildRangeTransaction,\n\tbuildWheelTransaction,\n} from './transactions/index.js';\nimport { TtlClientCache } from './ttl-cache.js';\nimport {\n\tGAME_SETTINGS,\n\ttype GameParameters,\n\ttype GetGameParametersOptions,\n} from './types/game-settings.type.js';\nimport {\n\tBuildCancelPvPCoinflipTransactionOptions,\n\tBuildCoinflipTransactionOptions,\n\tBuildCreatePvPCoinflipTransactionOptions,\n\tBuildGameOptions,\n\tBuildJoinPvPCoinflipTransactionOptions,\n\tBuildLimboTransactionOptions,\n\tBuildPlinkoTransactionOptions,\n\tBuildPvPCoinflipTransactionOptions,\n\tBuildRangeTransactionOptions,\n\tBuildWheelTransactionOptions,\n\tGame,\n\tPvPCoinflipAction,\n\tStandardGame,\n\tSuigarConfig,\n\tSuigarExtensionOptions,\n\tSuiNetwork,\n\tSUPPORTED_SUI_NETWORKS,\n\tWithPartner,\n\tWithThrowOnError,\n} from './types/index.js';\nimport { parseCoinType } from './utils/index.js';\n\nexport function suigar<const Name = 'suigar'>({\n\tname = 'suigar' as Name,\n\tpartner,\n\tcacheTtl,\n}: SuigarExtensionOptions<Name> = {}) {\n\treturn {\n\t\tname,\n\t\tregister: (client: ClientWithCoreApi): SuigarClient => {\n\t\t\treturn new SuigarClient({\n\t\t\t\tclient,\n\t\t\t\tname: String(name),\n\t\t\t\tpartner,\n\t\t\t\tcacheTtl,\n\t\t\t});\n\t\t},\n\t};\n}\n\nexport class SuigarClient {\n\t#client: ClientWithCoreApi;\n\n\t#config: SuigarConfig;\n\n\t#partner: string | undefined;\n\n\t#cache: TtlClientCache;\n\n\tconstructor({\n\t\tclient,\n\t\tname,\n\t\tpartner,\n\t\tcacheTtl,\n\t}: {\n\t\tclient: ClientWithCoreApi;\n\t\tname: string;\n\t\tpartner?: string;\n\t\tcacheTtl?: number;\n\t}) {\n\t\tthis.#client = client;\n\t\tthis.#partner = partner;\n\t\tthis.#cache = client.cache\n\t\t\t.scope('@suigar/sdk')\n\t\t\t.readSync([name, 'ttl-cache'], () => {\n\t\t\t\treturn new TtlClientCache({\n\t\t\t\t\tttlMs: cacheTtl ?? DEFAULT_CACHE_TTL_MS,\n\t\t\t\t});\n\t\t\t});\n\n\t\tconst network = this.#client.network as SuiNetwork;\n\t\tif (!SUPPORTED_SUI_NETWORKS.includes(network)) {\n\t\t\tthrow new RangeError(`Unsupported network: ${network}`);\n\t\t}\n\n\t\tthis.#config = resolveSuigarConfig(network);\n\t}\n\n\t/**\n\t * Returns the resolved SDK configuration for the connected network.\n\t *\n\t * This is primarily useful for debugging or inspecting which package ids,\n\t * registry ids, supported coin types, and price info object ids the SDK\n\t * resolved for the current client network.\n\t *\n\t * @returns Network-resolved Suigar configuration.\n\t */\n\tgetConfig(): SuigarConfig {\n\t\treturn this.#config;\n\t}\n\n\t/**\n\t * Builds a transaction with the configured Sui client and encodes the resulting BCS bytes as base64.\n\t *\n\t * Use this when an external wallet, API, or transport expects the built transaction payload as a base64 string\n\t * instead of raw bytes. The SDK always injects the configured Sui client, so `options` accepts the standard\n\t * transaction build options except for `client`.\n\t *\n\t * @param transaction Transaction to build and serialize.\n\t * @param options Optional transaction build options forwarded to `transaction.build()`, excluding `client`.\n\t * @returns Base64-encoded transaction bytes ready to send over the wire.\n\t */\n\tasync serializeTransactionToBase64(\n\t\ttransaction: Transaction,\n\t\toptions?: Omit<BuildTransactionOptions, 'client'>,\n\t): Promise<string> {\n\t\tconst bytes = await transaction.build({ ...options, client: this.#client });\n\t\treturn toBase64(bytes);\n\t}\n\n\t/**\n\t * Reads on-chain game parameters for the requested game.\n\t *\n\t * The SDK first reads the selected game's settings object from SweetHouse,\n\t * then reads that game's coin-specific `Parameters<T>` object. Results are\n\t * cached according to the extension `cacheTtl` option. Pass\n\t * `ignoreCache: true` to refresh the on-chain read and replace the cached\n\t * value.\n\t *\n\t * @param game Game whose parameters should be loaded.\n\t * @param options Optional coin type, cache override, and abort signal.\n\t * @returns Parsed game parameters typed for the requested game.\n\t */\n\tasync getGameParameters<TGame extends Game>(\n\t\tgame: TGame,\n\t\toptions: GetGameParametersOptions = {},\n\t): Promise<GameParameters<TGame>> {\n\t\tconst coinType = normalizeStructTag(\n\t\t\toptions.coinType ?? this.#config.coinTypes.sui,\n\t\t);\n\t\treturn this.#cache.read(\n\t\t\t['parameters', this.#client.network, game, coinType],\n\t\t\t() => this.#fetchGameParameters(game, coinType, options.signal),\n\t\t\t{ ignoreCache: options.ignoreCache },\n\t\t) as Promise<GameParameters<TGame>>;\n\t}\n\n\t/**\n\t * Lists unresolved PvP coinflip games from the configured registry and resolves\n\t * each entry into parsed on-chain game state.\n\t *\n\t * This fetches dynamic fields from the PvP coinflip registry object, then bulk\n\t * loads the referenced game objects through `client.core.getObjects()`. Registry\n\t * membership is the unresolved-state signal: when a game is joined and resolved,\n\t * the Move flow removes it from the registry and deletes the live `Game` object.\n\t * Use this when a product needs the current set of open PvP coinflip matches for\n\t * browsing or lobby views.\n\t *\n\t * @param options Optional dynamic field pagination forwarded to `listDynamicFields()`, excluding `parentId`.\n\t * Supported options such as `limit`, `cursor`, and `signal` are forwarded to the\n\t * underlying lookup calls. Pass `throwOnError: true` to fail the whole lookup\n\t * when any referenced game object cannot be fetched or parsed. By default,\n\t * failed per-object lookups are skipped and only successfully parsed unresolved\n\t * games are returned.\n\t * @returns Parsed unresolved PvP coinflip game objects for the requested\n\t * registry page. When `throwOnError` is `false`, entries that fail object fetch\n\t * or parse are omitted from the returned array.\n\t */\n\tasync getPvPCoinflipGames(\n\t\toptions: WithThrowOnError<\n\t\t\tOmit<SuiClientTypes.ListDynamicFieldsOptions, 'parentId'>\n\t\t> = {\n\t\t\tlimit: 50,\n\t\t},\n\t): Promise<(InferBcsType<typeof PvPCoinflipGame> & { coin_type: string })[]> {\n\t\tconst { throwOnError = false, ...listOptions } = options;\n\t\tconst { dynamicFields } = await this.#client.core.listDynamicFields({\n\t\t\t...listOptions,\n\t\t\tparentId: this.#config.registryIds.pvpCoinflip,\n\t\t});\n\n\t\tconst { objects } = await this.#client.core.getObjects({\n\t\t\tobjectIds: dynamicFields.map(({ childId }) => childId!),\n\t\t\tsignal: listOptions.signal,\n\t\t\tinclude: {\n\t\t\t\tcontent: true,\n\t\t\t},\n\t\t});\n\n\t\tconst resolvedGames = objects.map((object) => {\n\t\t\ttry {\n\t\t\t\tif (object instanceof Error) {\n\t\t\t\t\tthrow object;\n\t\t\t\t}\n\n\t\t\t\tif (!object.content) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'Unable to resolve PvP coinflip game from retrieved object',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\t...PvPCoinflipGame.parse(object.content),\n\t\t\t\t\tcoin_type: parseCoinType(object.type),\n\t\t\t\t} satisfies Awaited<\n\t\t\t\t\tReturnType<SuigarClient['getPvPCoinflipGames']>\n\t\t\t\t>[number];\n\t\t\t} catch (error) {\n\t\t\t\treturn error instanceof Error ? error : new Error(String(error));\n\t\t\t}\n\t\t});\n\n\t\tif (throwOnError) {\n\t\t\tconst firstError = resolvedGames.find((game) => game instanceof Error);\n\t\t\tif (firstError) {\n\t\t\t\tthrow firstError;\n\t\t\t}\n\t\t}\n\n\t\treturn resolvedGames.flatMap((game) =>\n\t\t\tgame instanceof Error ? [] : [game],\n\t\t);\n\t}\n\n\t/**\n\t * BCS struct constructors for decoding on-chain objects and events related to Suigar games.\n\t *\n\t * These can be used to parse the `content` field of on-chain objects and events into structured data with the\n\t * expected types. For example, use `client.suigar.bcs.PvPCoinflipGame.parse(object.content)` to decode a PvP\n\t * coinflip game object.\n\t *\n\t * Note that these constructors are not meant for encoding transaction arguments, as the SDK's transaction\n\t * builders handle argument serialization internally. Use these primarily for decoding and parsing on-chain data.\n\t */\n\tbcs = {\n\t\t// Objects\n\t\t/**\n\t\t * Object representing the state of a PvP coinflip game, as stored on-chain.\n\t\t */\n\t\tPvPCoinflipGame,\n\t\t// Events\n\t\t/**\n\t\t * Event emitted at the end of a standard game (e.g., Coinflip, Limbo), containing the result and payout information.\n\t\t */\n\t\tBetResultEvent,\n\t\t/**\n\t\t * Event emitted when a PvP Coinflip game is created, containing the game configuration and initial state.\n\t\t */\n\t\tPvPCoinflipGameCreatedEvent,\n\t\t/**\n\t\t * Event emitted when a PvP Coinflip game is resolved, containing the final outcome.\n\t\t */\n\t\tPvPCoinflipGameResolvedEvent,\n\t\t/**\n\t\t * Event emitted when a PvP Coinflip game is cancelled.\n\t\t */\n\t\tPvPCoinflipGameCancelledEvent,\n\t};\n\n\t/**\n\t * Transaction builders for Suigar games.\n\t */\n\ttx = {\n\t\t/**\n\t\t * Creates a standard game transaction for the provided game id.\n\t\t *\n\t\t * @param gameId Supported standard game identifier.\n\t\t * @param options Transaction builder options for the selected game.\n\t\t * @returns Prepared transaction for the selected game.\n\t\t */\n\t\tcreateBetTransaction: <GameId extends StandardGame>(\n\t\t\tgameId: GameId,\n\t\t\toptions: BuildGameOptions<GameId>,\n\t\t): Transaction => {\n\t\t\tswitch (gameId) {\n\t\t\t\tcase 'coinflip':\n\t\t\t\t\treturn buildCoinflipTransaction({\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\t\tpartner: this.#partner,\n\t\t\t\t\t} as WithPartner<BuildCoinflipTransactionOptions>);\n\t\t\t\tcase 'limbo':\n\t\t\t\t\treturn buildLimboTransaction({\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\t\tpartner: this.#partner,\n\t\t\t\t\t} as WithPartner<BuildLimboTransactionOptions>);\n\t\t\t\tcase 'plinko':\n\t\t\t\t\treturn buildPlinkoTransaction({\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\t\tpartner: this.#partner,\n\t\t\t\t\t} as WithPartner<BuildPlinkoTransactionOptions>);\n\t\t\t\tcase 'range':\n\t\t\t\t\treturn buildRangeTransaction({\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\t\tpartner: this.#partner,\n\t\t\t\t\t} as WithPartner<BuildRangeTransactionOptions>);\n\t\t\t\tcase 'wheel':\n\t\t\t\t\treturn buildWheelTransaction({\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\t\tpartner: this.#partner,\n\t\t\t\t\t} as WithPartner<BuildWheelTransactionOptions>);\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new RangeError(`Unsupported game: ${gameId}`);\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * Creates a PvP coinflip transaction for the requested action.\n\t\t *\n\t\t * @param action PvP coinflip action to perform.\n\t\t * @param options Transaction builder options for the selected action.\n\t\t * @returns Prepared PvP coinflip transaction.\n\t\t */\n\t\tcreatePvPCoinflipTransaction: <Action extends PvPCoinflipAction>(\n\t\t\taction: Action,\n\t\t\toptions: BuildPvPCoinflipTransactionOptions<Action>,\n\t\t): Transaction => {\n\t\t\tswitch (action) {\n\t\t\t\tcase 'create':\n\t\t\t\t\treturn buildPvPCoinflipTransaction('create', {\n\t\t\t\t\t\t...(options as BuildCreatePvPCoinflipTransactionOptions),\n\t\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\t\tpartner: this.#partner,\n\t\t\t\t\t});\n\t\t\t\tcase 'join': {\n\t\t\t\t\tconst joinOptions = options as BuildJoinPvPCoinflipTransactionOptions;\n\t\t\t\t\treturn buildPvPCoinflipTransaction('join', {\n\t\t\t\t\t\t...joinOptions,\n\t\t\t\t\t\tbetCoin: this.#createPvPCoinflipBetCoin(joinOptions),\n\t\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\t\tpartner: this.#partner,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tcase 'cancel':\n\t\t\t\t\treturn buildPvPCoinflipTransaction('cancel', {\n\t\t\t\t\t\t...(options as BuildCancelPvPCoinflipTransactionOptions),\n\t\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\t\tpartner: this.#partner,\n\t\t\t\t\t});\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new RangeError(`Unsupported PvP coinflip action: ${action}`);\n\t\t\t}\n\t\t},\n\t};\n\n\t#createPvPCoinflipBetCoin(\n\t\toptions: BuildJoinPvPCoinflipTransactionOptions,\n\t): (tx: Transaction) => Promise<TransactionResult> {\n\t\treturn async (tx: Transaction) => {\n\t\t\tconst { json } = await PvPCoinflipGame.get({\n\t\t\t\tclient: this.#client,\n\t\t\t\tobjectId: options.gameId,\n\t\t\t});\n\n\t\t\treturn tx.coin({\n\t\t\t\ttype: options.coinType,\n\t\t\t\tbalance: BigInt(json.stake_per_player),\n\t\t\t\tuseGasCoin: options.allowGasCoinShortcut,\n\t\t\t});\n\t\t};\n\t}\n\n\tasync #fetchGameParameters<TGame extends Game>(\n\t\tgame: TGame,\n\t\tcoinType: string,\n\t\tsignal?: AbortSignal,\n\t): Promise<GameParameters<TGame>> {\n\t\tconst gameDefinition = GAME_SETTINGS[game];\n\n\t\tconst { object: settingsObject } =\n\t\t\tawait this.#client.core.getDynamicObjectField({\n\t\t\t\tparentId: this.#config.packageIds.sweetHouse,\n\t\t\t\tname: {\n\t\t\t\t\ttype: resolveGameSettingsKeyType(\n\t\t\t\t\t\tgameDefinition.settingsKey.name,\n\t\t\t\t\t\tresolveGamePackageId(this.#config, game),\n\t\t\t\t\t),\n\t\t\t\t\tbcs: gameDefinition.settingsKey\n\t\t\t\t\t\t.serialize({ dummy_field: false })\n\t\t\t\t\t\t.toBytes(),\n\t\t\t\t},\n\t\t\t\tsignal,\n\t\t\t});\n\n\t\tconst { object } = await this.#client.core.getDynamicObjectField({\n\t\t\tparentId: settingsObject.objectId,\n\t\t\tname: {\n\t\t\t\ttype: TypeName.name,\n\t\t\t\tbcs: TypeName.serialize({\n\t\t\t\t\tname: resolveCoinTypeNameForTypeNameKey(coinType),\n\t\t\t\t}).toBytes(),\n\t\t\t},\n\t\t\tinclude: {\n\t\t\t\tcontent: true,\n\t\t\t},\n\t\t\tsignal,\n\t\t});\n\n\t\tif (!object?.content) {\n\t\t\tthrow new Error(\n\t\t\t\t`Missing parameters object content for ${game} and coin type ${coinType}`,\n\t\t\t);\n\t\t}\n\n\t\treturn gameDefinition.parameters.parse(\n\t\t\tobject.content,\n\t\t) as GameParameters<TGame>;\n\t}\n}\n"],"mappings":"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"}
@@ -0,0 +1,23 @@
1
+ //#region src/configs/package.mainnet.ts
2
+ const MAINNET_PACKAGE_IDS = {
3
+ sweetHouse: "0xa1549d73230118716bc08865b8d62454f360ddaf40eee2158e458e52125d4ef1",
4
+ core: "0xcbb0929f21450013ebe5e86e7139f2409da2e3ed212c51126a7e6448b795a43f",
5
+ coinflip: "0xca96885371150f55653f7fab9e9b146f5a19698b1002bdff42159ea9d2ba7d7e",
6
+ limbo: "0x89db6a55ad4e650cad641b6f9fd90b391b22b1d9adbb2cabbfeb94a9eeda7026",
7
+ plinko: "0x74a73daff11c11ed05299c93ed770c62ec4dc6756fa99e271e251c2399f49fef",
8
+ pvpCoinflip: "0x29162faf01a8135630e0a32bbe4ce47f69607b24dbb1edea3800861f91d0030a",
9
+ range: "0xd19e32b0f2a5e541fbd345b4602f8a93a2eee25c16029595b6fef0b1e0461a54",
10
+ wheel: "0x6791eac73fe7bf463b7f3b1ea391df265fbc1b96201270664a5a11e2441e9955"
11
+ };
12
+ const MAINNET_COIN_TYPES = {
13
+ sui: "0x2::sui::SUI",
14
+ usdc: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
15
+ };
16
+ const MAINNET_PRICE_INFO_OBJECT_IDS = {
17
+ sui: "0x801dbc2f0053d34734814b2d6df491ce7807a725fe9a01ad74a07e9c51396c37",
18
+ usdc: "0x5dec622733a204ca27f5a90d8c2fad453cc6665186fd5dff13a83d0b6c9027ab"
19
+ };
20
+ //#endregion
21
+ export { MAINNET_COIN_TYPES, MAINNET_PACKAGE_IDS, MAINNET_PRICE_INFO_OBJECT_IDS };
22
+
23
+ //# sourceMappingURL=package.mainnet.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.mainnet.mjs","names":[],"sources":["../../src/configs/package.mainnet.ts"],"sourcesContent":["// Copyright (c) Suigar\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tSuigarCoinTypes,\n\tSuigarPackageIds,\n\tSuigarPriceInfoObjectIds,\n} from '../types/suigar-config.type.js';\n\n// `sweetHouse` is preserved manually because it is not currently resolved from MVR.\nexport const MAINNET_PACKAGE_IDS: SuigarPackageIds = {\n\tsweetHouse:\n\t\t'0xa1549d73230118716bc08865b8d62454f360ddaf40eee2158e458e52125d4ef1',\n\tcore: '0xcbb0929f21450013ebe5e86e7139f2409da2e3ed212c51126a7e6448b795a43f',\n\tcoinflip:\n\t\t'0xca96885371150f55653f7fab9e9b146f5a19698b1002bdff42159ea9d2ba7d7e',\n\tlimbo: '0x89db6a55ad4e650cad641b6f9fd90b391b22b1d9adbb2cabbfeb94a9eeda7026',\n\tplinko: '0x74a73daff11c11ed05299c93ed770c62ec4dc6756fa99e271e251c2399f49fef',\n\tpvpCoinflip:\n\t\t'0x29162faf01a8135630e0a32bbe4ce47f69607b24dbb1edea3800861f91d0030a',\n\trange: '0xd19e32b0f2a5e541fbd345b4602f8a93a2eee25c16029595b6fef0b1e0461a54',\n\twheel: '0x6791eac73fe7bf463b7f3b1ea391df265fbc1b96201270664a5a11e2441e9955',\n};\n\nexport const MAINNET_COIN_TYPES: SuigarCoinTypes = {\n\tsui: '0x2::sui::SUI',\n\tusdc: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC',\n};\n\nexport const MAINNET_PRICE_INFO_OBJECT_IDS: SuigarPriceInfoObjectIds = {\n\tsui: '0x801dbc2f0053d34734814b2d6df491ce7807a725fe9a01ad74a07e9c51396c37',\n\tusdc: '0x5dec622733a204ca27f5a90d8c2fad453cc6665186fd5dff13a83d0b6c9027ab',\n};\n"],"mappings":";AAUA,MAAa,sBAAwC;CACpD,YACC;CACD,MAAM;CACN,UACC;CACD,OAAO;CACP,QAAQ;CACR,aACC;CACD,OAAO;CACP,OAAO;AACR;AAEA,MAAa,qBAAsC;CAClD,KAAK;CACL,MAAM;AACP;AAEA,MAAa,gCAA0D;CACtE,KAAK;CACL,MAAM;AACP"}
@@ -0,0 +1,19 @@
1
+ import { MAINNET_COIN_TYPES, MAINNET_PACKAGE_IDS, MAINNET_PRICE_INFO_OBJECT_IDS } from "./package.mainnet.mjs";
2
+ import { TESTNET_COIN_TYPES, TESTNET_PACKAGE_IDS, TESTNET_PRICE_INFO_OBJECT_IDS } from "./package.testnet.mjs";
3
+ //#region src/configs/package.ts
4
+ const PACKAGE_IDS = {
5
+ mainnet: { ...MAINNET_PACKAGE_IDS },
6
+ testnet: { ...TESTNET_PACKAGE_IDS }
7
+ };
8
+ const COIN_TYPES = {
9
+ mainnet: { ...MAINNET_COIN_TYPES },
10
+ testnet: { ...TESTNET_COIN_TYPES }
11
+ };
12
+ const PRICE_INFO_OBJECT_IDS = {
13
+ mainnet: { ...MAINNET_PRICE_INFO_OBJECT_IDS },
14
+ testnet: { ...TESTNET_PRICE_INFO_OBJECT_IDS }
15
+ };
16
+ //#endregion
17
+ export { COIN_TYPES, PACKAGE_IDS, PRICE_INFO_OBJECT_IDS };
18
+
19
+ //# sourceMappingURL=package.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.mjs","names":[],"sources":["../../src/configs/package.ts"],"sourcesContent":["// Copyright (c) Suigar\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tSuigarCoinTypes,\n\tSuigarPackageIds,\n\tSuigarPriceInfoObjectIds,\n\tSuiNetworkRegistry,\n} from '../types/suigar-config.type.js';\nimport {\n\tMAINNET_COIN_TYPES,\n\tMAINNET_PACKAGE_IDS,\n\tMAINNET_PRICE_INFO_OBJECT_IDS,\n} from './package.mainnet.js';\nimport {\n\tTESTNET_COIN_TYPES,\n\tTESTNET_PACKAGE_IDS,\n\tTESTNET_PRICE_INFO_OBJECT_IDS,\n} from './package.testnet.js';\n\nexport const PACKAGE_IDS: SuiNetworkRegistry<SuigarPackageIds> = {\n\tmainnet: { ...MAINNET_PACKAGE_IDS },\n\ttestnet: { ...TESTNET_PACKAGE_IDS },\n};\n\nexport const COIN_TYPES: SuiNetworkRegistry<SuigarCoinTypes> = {\n\tmainnet: { ...MAINNET_COIN_TYPES },\n\ttestnet: { ...TESTNET_COIN_TYPES },\n};\n\nexport const PRICE_INFO_OBJECT_IDS: SuiNetworkRegistry<SuigarPriceInfoObjectIds> =\n\t{\n\t\tmainnet: { ...MAINNET_PRICE_INFO_OBJECT_IDS },\n\t\ttestnet: { ...TESTNET_PRICE_INFO_OBJECT_IDS },\n\t};\n"],"mappings":";;;AAoBA,MAAa,cAAoD;CAChE,SAAS,EAAE,GAAG,oBAAoB;CAClC,SAAS,EAAE,GAAG,oBAAoB;AACnC;AAEA,MAAa,aAAkD;CAC9D,SAAS,EAAE,GAAG,mBAAmB;CACjC,SAAS,EAAE,GAAG,mBAAmB;AAClC;AAEA,MAAa,wBACZ;CACC,SAAS,EAAE,GAAG,8BAA8B;CAC5C,SAAS,EAAE,GAAG,8BAA8B;AAC7C"}