@suigar/sdk 2.0.0-beta.12 → 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 +25 -8
- package/README.md +8 -8
- package/dist/{games-BHYRg31e.d.cts → games-Da2uZvVJ.d.cts} +8 -8
- package/dist/{games-BHYRg31e.d.ts → games-Da2uZvVJ.d.ts} +8 -8
- package/dist/games.d.cts +1 -1
- package/dist/games.d.ts +1 -1
- package/dist/index.cjs +10 -10
- package/dist/index.d.cts +35 -25
- package/dist/index.d.ts +35 -25
- package/dist/index.js +10 -10
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
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
|
+
|
|
14
|
+
## 2.0.0-beta.13
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 667d7c4: Normalize repository wording to use `on-chain` consistently.
|
|
19
|
+
|
|
3
20
|
## 2.0.0-beta.12
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -13,9 +30,9 @@
|
|
|
13
30
|
|
|
14
31
|
### Patch Changes
|
|
15
32
|
|
|
16
|
-
- c7685d2: Add `client.suigar.getGameParameters(game, options?)` for reading live
|
|
33
|
+
- c7685d2: Add `client.suigar.getGameParameters(game, options?)` for reading live on-chain game parameter objects, such as min/max stake and game-specific config bounds, directly from SweetHouse settings.
|
|
17
34
|
|
|
18
|
-
The lookup first reads the selected game's settings object from SweetHouse, then reads that game's coin-specific `Parameters<T>` object, parses it with the correct return type for the requested game, and caches the result for SDK integrations that need to display or validate current game limits without repeatedly querying the same
|
|
35
|
+
The lookup first reads the selected game's settings object from SweetHouse, then reads that game's coin-specific `Parameters<T>` object, parses it with the correct return type for the requested game, and caches the result for SDK integrations that need to display or validate current game limits without repeatedly querying the same on-chain objects.
|
|
19
36
|
|
|
20
37
|
This update also broadens the public numeric helpers in `@suigar/sdk/utils`: `toBigInt()` accepts booleans and non-negative integer strings in addition to numbers and `bigint`, `toU8()` accepts plain integer strings such as `'1'` for parsed config ids and other `u8` values, and `toU16()` provides the same validation pattern for `u16` values.
|
|
21
38
|
|
|
@@ -23,7 +40,7 @@
|
|
|
23
40
|
|
|
24
41
|
### Patch Changes
|
|
25
42
|
|
|
26
|
-
- 4b59c7b: Remove the `client.suigar.
|
|
43
|
+
- 4b59c7b: Remove the `client.suigar.resolvePvPCoinflipGame()` client method. Use the exported generated helper `client.suigar.bcs.PvPCoinflipGame.get({ client, objectId })` for one specific live PvP coinflip game object instead.
|
|
27
44
|
|
|
28
45
|
Add `parseCoinType` to `@suigar/sdk/utils` for extracting normalized coin types from generic Move object type strings.
|
|
29
46
|
|
|
@@ -49,7 +66,7 @@
|
|
|
49
66
|
- a2aa324: Update PvP coinflip lookup helpers to use bulk object reads for unresolved lobby discovery and support forwarded lookup options.
|
|
50
67
|
- Make `getPvPCoinflipGames()` parse bulk `client.core.getObjects()` results instead of resolving each game individually.
|
|
51
68
|
- Skip per-object fetch or parse failures by default and continue supporting strict rejection with `throwOnError: true`.
|
|
52
|
-
- Forward supported lookup options such as `signal` through `getPvPCoinflipGames()` and `
|
|
69
|
+
- Forward supported lookup options such as `signal` through `getPvPCoinflipGames()` and `resolvePvPCoinflipGame(gameId, options?)`.
|
|
53
70
|
- Update tests, README guidance, and repo-local PvP skill documentation to match the current client behavior.
|
|
54
71
|
|
|
55
72
|
## 2.0.0-beta.7
|
|
@@ -79,22 +96,22 @@
|
|
|
79
96
|
|
|
80
97
|
### Patch Changes
|
|
81
98
|
|
|
82
|
-
- 6daa819: Add BCS parser helpers and a Next.js
|
|
99
|
+
- 6daa819: Add BCS parser helpers and a Next.js playground example app.
|
|
83
100
|
- expose parser helpers through `@suigar/sdk/utils`
|
|
84
101
|
- add `parseGameDetails` for decoding `BetResultEvent.game_details`
|
|
85
102
|
- document generated BCS event decoding and game detail parsing guidance
|
|
86
|
-
- add a testnet-only
|
|
103
|
+
- add a testnet-only app for standard and PvP Suigar transactions
|
|
87
104
|
- integrate Mysten dApp Kit wallet connection, signing, and execution
|
|
88
105
|
- add live transaction code previews and shared decoded event logging with SDK parser helpers
|
|
89
106
|
- add Suigar-themed responsive UI, supported coin selection, and human-readable stake handling
|
|
90
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
|
|
91
108
|
|
|
92
109
|
- b89d0b4: Add a public `@suigar/sdk/games` export subpath for shared game option types, and export `SuigarClient` from the package root.
|
|
93
|
-
- bf1f71b: Add `registryIds` to `SuigarConfig` and resolve
|
|
110
|
+
- bf1f71b: Add `registryIds` to `SuigarConfig` and resolve them from the network config registry map.
|
|
94
111
|
|
|
95
112
|
Document the PvP coinflip runtime helpers more clearly by describing
|
|
96
113
|
registry-backed unresolved game discovery through `getPvPCoinflipGames()` and
|
|
97
|
-
the normalized live-game lookup behavior of `
|
|
114
|
+
the normalized live-game lookup behavior of `resolvePvPCoinflipGame()`.
|
|
98
115
|
|
|
99
116
|
- 4861f55: Add public utility exports for shared scaling constants in `@suigar/sdk/utils`, including `RANGE_POINT_LIMIT` and `DEFAULT_RANGE_SCALE`. Update the SDK example app and documentation to use the exported constants and document limbo/range scaling behavior more clearly.
|
|
100
117
|
|
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ Numeric helper behavior:
|
|
|
73
73
|
Move object type string and throws `TypeError` when no coin type can be parsed
|
|
74
74
|
- `parseGameDetails(gameDetails)` decodes standard `BetResultEvent.game_details`
|
|
75
75
|
byte arrays into the expected string, number, and boolean values while
|
|
76
|
-
preserving the original
|
|
76
|
+
preserving the original on-chain keys
|
|
77
77
|
|
|
78
78
|
Game-specific type exports are available from the dedicated `games` subpath:
|
|
79
79
|
|
|
@@ -147,7 +147,7 @@ client.suigar;
|
|
|
147
147
|
```
|
|
148
148
|
|
|
149
149
|
Do not pass a partner slug, label, or display name here. Use the wallet
|
|
150
|
-
address that should receive partner attribution
|
|
150
|
+
address that should receive partner attribution on-chain.
|
|
151
151
|
|
|
152
152
|
You can rename the extension:
|
|
153
153
|
|
|
@@ -177,11 +177,11 @@ Supported override areas:
|
|
|
177
177
|
- `cacheTtl`
|
|
178
178
|
|
|
179
179
|
If `partner` is configured, the SDK automatically writes that partner wallet
|
|
180
|
-
address into the
|
|
180
|
+
address into the on-chain metadata vec-map. Transaction builder options may also
|
|
181
181
|
include `metadata`, but reserved keys such as `partner` and `referrer` are
|
|
182
182
|
ignored with a warning when provided manually.
|
|
183
183
|
|
|
184
|
-
`cacheTtl` controls the SDK cache for
|
|
184
|
+
`cacheTtl` controls the SDK cache for on-chain reads such as parsed game
|
|
185
185
|
parameters. It is expressed in milliseconds and defaults to 30 minutes.
|
|
186
186
|
|
|
187
187
|
## Runtime Surface
|
|
@@ -216,7 +216,7 @@ console.log(config.packageIds);
|
|
|
216
216
|
|
|
217
217
|
### `getGameParameters(game, options?)`
|
|
218
218
|
|
|
219
|
-
Returns the
|
|
219
|
+
Returns the on-chain `Parameters<T>` object for any supported game and coin type.
|
|
220
220
|
The return type is inferred from `game`.
|
|
221
221
|
|
|
222
222
|
The SDK first reads the selected game's settings object from the configured
|
|
@@ -237,7 +237,7 @@ const parameters = await client.suigar.getGameParameters('coinflip', {
|
|
|
237
237
|
console.log(parameters.min_stake);
|
|
238
238
|
```
|
|
239
239
|
|
|
240
|
-
Pass `ignoreCache: true` to refresh the
|
|
240
|
+
Pass `ignoreCache: true` to refresh the on-chain read and replace the cached
|
|
241
241
|
value.
|
|
242
242
|
|
|
243
243
|
### `serializeTransactionToBase64(transaction, options?)`
|
|
@@ -368,7 +368,7 @@ const rangeTx = client.suigar.tx.createBetTransaction('range', {
|
|
|
368
368
|
> **Note:**
|
|
369
369
|
>
|
|
370
370
|
> - limbo converts `targetMultiplier` with `Math.round(targetMultiplier * scale)`
|
|
371
|
-
> - with the default limbo scale `100`, exposed as `DEFAULT_LIMBO_MULTIPLIER_SCALE`, a target multiplier of `2.5` becomes `250`
|
|
371
|
+
> - with the default limbo scale `100`, exposed as `DEFAULT_LIMBO_MULTIPLIER_SCALE`, a target multiplier of `2.5` becomes `250` on-chain
|
|
372
372
|
> - range converts each point with `Math.round(value * scale)`
|
|
373
373
|
> - range points are bounded by the contract limit exposed as `RANGE_POINT_LIMIT`
|
|
374
374
|
> - with the default range scale `1_000_000`, exposed as `DEFAULT_RANGE_SCALE`, valid UI values are `0` to `100`
|
|
@@ -534,7 +534,7 @@ const decoded = client.suigar.bcs.BetResultEvent.parse(event.bcs);
|
|
|
534
534
|
const gameDetails = parseGameDetails(decoded.game_details);
|
|
535
535
|
```
|
|
536
536
|
|
|
537
|
-
`parseGameDetails` preserves the
|
|
537
|
+
`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
538
|
|
|
539
539
|
When the extension is configured with `partner`, decoded event `metadata` will
|
|
540
540
|
contain that partner wallet address under the `partner` entry.
|
|
@@ -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
|
|
32
|
-
type
|
|
33
|
-
type
|
|
34
|
-
type
|
|
35
|
-
type
|
|
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:
|
|
38
|
-
registryIds:
|
|
37
|
+
packageIds: SuigarPackageIds;
|
|
38
|
+
registryIds: SuigarRegistryIds;
|
|
39
39
|
coinTypes: SuigarCoinTypes;
|
|
40
|
-
priceInfoObjectIds:
|
|
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
|
|
32
|
-
type
|
|
33
|
-
type
|
|
34
|
-
type
|
|
35
|
-
type
|
|
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:
|
|
38
|
-
registryIds:
|
|
37
|
+
packageIds: SuigarPackageIds;
|
|
38
|
+
registryIds: SuigarRegistryIds;
|
|
39
39
|
coinTypes: SuigarCoinTypes;
|
|
40
|
-
priceInfoObjectIds:
|
|
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-
|
|
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-
|
|
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
|
|
418
|
+
var MAINNET_REGISTRY_IDS = {
|
|
419
|
+
pvpCoinflip: "0x3d73568546c539c1da3eb2b8fe917faef3c0acdbec78a67fe6d52800a0729349"
|
|
420
|
+
};
|
|
419
421
|
|
|
420
422
|
// src/configs/registry.testnet.ts
|
|
421
|
-
var
|
|
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
|
-
|
|
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
|
|
@@ -1441,7 +1441,7 @@ var SuigarClient = class {
|
|
|
1441
1441
|
* The SDK first reads the selected game's settings object from SweetHouse,
|
|
1442
1442
|
* then reads that game's coin-specific `Parameters<T>` object. Results are
|
|
1443
1443
|
* cached according to the extension `cacheTtl` option. Pass
|
|
1444
|
-
* `ignoreCache: true` to refresh the
|
|
1444
|
+
* `ignoreCache: true` to refresh the on-chain read and replace the cached
|
|
1445
1445
|
* value.
|
|
1446
1446
|
*
|
|
1447
1447
|
* @param game Game whose parameters should be loaded.
|
|
@@ -1460,7 +1460,7 @@ var SuigarClient = class {
|
|
|
1460
1460
|
}
|
|
1461
1461
|
/**
|
|
1462
1462
|
* Lists unresolved PvP coinflip games from the configured registry and resolves
|
|
1463
|
-
* each entry into parsed
|
|
1463
|
+
* each entry into parsed on-chain game state.
|
|
1464
1464
|
*
|
|
1465
1465
|
* This fetches dynamic fields from the PvP coinflip registry object, then bulk
|
|
1466
1466
|
* loads the referenced game objects through `client.core.getObjects()`. Registry
|
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-
|
|
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;
|
|
@@ -243,17 +270,17 @@ declare class SuigarClient {
|
|
|
243
270
|
* The SDK first reads the selected game's settings object from SweetHouse,
|
|
244
271
|
* then reads that game's coin-specific `Parameters<T>` object. Results are
|
|
245
272
|
* cached according to the extension `cacheTtl` option. Pass
|
|
246
|
-
* `ignoreCache: true` to refresh the
|
|
273
|
+
* `ignoreCache: true` to refresh the on-chain read and replace the cached
|
|
247
274
|
* value.
|
|
248
275
|
*
|
|
249
276
|
* @param game Game whose parameters should be loaded.
|
|
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
|
-
* each entry into parsed
|
|
283
|
+
* each entry into parsed on-chain game state.
|
|
257
284
|
*
|
|
258
285
|
* This fetches dynamic fields from the PvP coinflip registry object, then bulk
|
|
259
286
|
* loads the referenced game objects through `client.core.getObjects()`. Registry
|
|
@@ -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
|
-
|
|
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-
|
|
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;
|
|
@@ -243,17 +270,17 @@ declare class SuigarClient {
|
|
|
243
270
|
* The SDK first reads the selected game's settings object from SweetHouse,
|
|
244
271
|
* then reads that game's coin-specific `Parameters<T>` object. Results are
|
|
245
272
|
* cached according to the extension `cacheTtl` option. Pass
|
|
246
|
-
* `ignoreCache: true` to refresh the
|
|
273
|
+
* `ignoreCache: true` to refresh the on-chain read and replace the cached
|
|
247
274
|
* value.
|
|
248
275
|
*
|
|
249
276
|
* @param game Game whose parameters should be loaded.
|
|
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
|
-
* each entry into parsed
|
|
283
|
+
* each entry into parsed on-chain game state.
|
|
257
284
|
*
|
|
258
285
|
* This fetches dynamic fields from the PvP coinflip registry object, then bulk
|
|
259
286
|
* loads the referenced game objects through `client.core.getObjects()`. Registry
|
|
@@ -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
|
-
|
|
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
|
|
258
|
+
var MAINNET_REGISTRY_IDS = {
|
|
259
|
+
pvpCoinflip: "0x3d73568546c539c1da3eb2b8fe917faef3c0acdbec78a67fe6d52800a0729349"
|
|
260
|
+
};
|
|
259
261
|
|
|
260
262
|
// src/configs/registry.testnet.ts
|
|
261
|
-
var
|
|
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
|
-
|
|
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
|
|
@@ -1220,7 +1220,7 @@ var SuigarClient = class {
|
|
|
1220
1220
|
* The SDK first reads the selected game's settings object from SweetHouse,
|
|
1221
1221
|
* then reads that game's coin-specific `Parameters<T>` object. Results are
|
|
1222
1222
|
* cached according to the extension `cacheTtl` option. Pass
|
|
1223
|
-
* `ignoreCache: true` to refresh the
|
|
1223
|
+
* `ignoreCache: true` to refresh the on-chain read and replace the cached
|
|
1224
1224
|
* value.
|
|
1225
1225
|
*
|
|
1226
1226
|
* @param game Game whose parameters should be loaded.
|
|
@@ -1239,7 +1239,7 @@ var SuigarClient = class {
|
|
|
1239
1239
|
}
|
|
1240
1240
|
/**
|
|
1241
1241
|
* Lists unresolved PvP coinflip games from the configured registry and resolves
|
|
1242
|
-
* each entry into parsed
|
|
1242
|
+
* each entry into parsed on-chain game state.
|
|
1243
1243
|
*
|
|
1244
1244
|
* This fetches dynamic fields from the PvP coinflip registry object, then bulk
|
|
1245
1245
|
* loads the referenced game objects through `client.core.getObjects()`. Registry
|
package/dist/utils.d.cts
CHANGED
|
@@ -145,7 +145,7 @@ declare function fromMoveI64(i64: MoveFloat['exp']): number;
|
|
|
145
145
|
*
|
|
146
146
|
* Suigar float values are represented as a sign flag, an unsigned mantissa,
|
|
147
147
|
* and a Move `i64` exponent. This helper rebuilds the numeric value using the
|
|
148
|
-
* same normalization expected by the
|
|
148
|
+
* same normalization expected by the on-chain format and applies the sign at
|
|
149
149
|
* the end. Missing mantissas are treated as `0`, and a zero mantissa returns `0`.
|
|
150
150
|
*
|
|
151
151
|
* @param float Generated Move float value with `mant`, `exp`, and `is_negative`.
|
|
@@ -169,7 +169,7 @@ declare function parseCoinType(type: string): string;
|
|
|
169
169
|
* Suigar stores game detail entries as `VecMap<string, vector<u8>>`, so raw BCS
|
|
170
170
|
* decoding leaves each value as bytes. This helper looks up the known schema for
|
|
171
171
|
* each key, parses the bytes into the expected runtime type, and preserves the
|
|
172
|
-
* original
|
|
172
|
+
* original on-chain keys in the returned object. Unknown keys fall back to
|
|
173
173
|
* string decoding so newer detail fields remain readable by default.
|
|
174
174
|
*
|
|
175
175
|
* @param gameDetails Raw `game_details` map from a decoded bet result event.
|
package/dist/utils.d.ts
CHANGED
|
@@ -145,7 +145,7 @@ declare function fromMoveI64(i64: MoveFloat['exp']): number;
|
|
|
145
145
|
*
|
|
146
146
|
* Suigar float values are represented as a sign flag, an unsigned mantissa,
|
|
147
147
|
* and a Move `i64` exponent. This helper rebuilds the numeric value using the
|
|
148
|
-
* same normalization expected by the
|
|
148
|
+
* same normalization expected by the on-chain format and applies the sign at
|
|
149
149
|
* the end. Missing mantissas are treated as `0`, and a zero mantissa returns `0`.
|
|
150
150
|
*
|
|
151
151
|
* @param float Generated Move float value with `mant`, `exp`, and `is_negative`.
|
|
@@ -169,7 +169,7 @@ declare function parseCoinType(type: string): string;
|
|
|
169
169
|
* Suigar stores game detail entries as `VecMap<string, vector<u8>>`, so raw BCS
|
|
170
170
|
* decoding leaves each value as bytes. This helper looks up the known schema for
|
|
171
171
|
* each key, parses the bytes into the expected runtime type, and preserves the
|
|
172
|
-
* original
|
|
172
|
+
* original on-chain keys in the returned object. Unknown keys fall back to
|
|
173
173
|
* string decoding so newer detail fields remain readable by default.
|
|
174
174
|
*
|
|
175
175
|
* @param gameDetails Raw `game_details` map from a decoded bet result event.
|