@suigar/sdk 2.0.0-beta.12 → 2.0.0-beta.13
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 +11 -5
- package/README.md +8 -8
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- 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,11 @@
|
|
|
1
1
|
# @suigar/sdk
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 667d7c4: Normalize authored repository wording to use `on-chain` consistently.
|
|
8
|
+
|
|
3
9
|
## 2.0.0-beta.12
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -13,9 +19,9 @@
|
|
|
13
19
|
|
|
14
20
|
### Patch Changes
|
|
15
21
|
|
|
16
|
-
- c7685d2: Add `client.suigar.getGameParameters(game, options?)` for reading live
|
|
22
|
+
- 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
23
|
|
|
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
|
|
24
|
+
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
25
|
|
|
20
26
|
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
27
|
|
|
@@ -23,7 +29,7 @@
|
|
|
23
29
|
|
|
24
30
|
### Patch Changes
|
|
25
31
|
|
|
26
|
-
- 4b59c7b: Remove the `client.suigar.
|
|
32
|
+
- 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
33
|
|
|
28
34
|
Add `parseCoinType` to `@suigar/sdk/utils` for extracting normalized coin types from generic Move object type strings.
|
|
29
35
|
|
|
@@ -49,7 +55,7 @@
|
|
|
49
55
|
- a2aa324: Update PvP coinflip lookup helpers to use bulk object reads for unresolved lobby discovery and support forwarded lookup options.
|
|
50
56
|
- Make `getPvPCoinflipGames()` parse bulk `client.core.getObjects()` results instead of resolving each game individually.
|
|
51
57
|
- 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 `
|
|
58
|
+
- Forward supported lookup options such as `signal` through `getPvPCoinflipGames()` and `resolvePvPCoinflipGame(gameId, options?)`.
|
|
53
59
|
- Update tests, README guidance, and repo-local PvP skill documentation to match the current client behavior.
|
|
54
60
|
|
|
55
61
|
## 2.0.0-beta.7
|
|
@@ -94,7 +100,7 @@
|
|
|
94
100
|
|
|
95
101
|
Document the PvP coinflip runtime helpers more clearly by describing
|
|
96
102
|
registry-backed unresolved game discovery through `getPvPCoinflipGames()` and
|
|
97
|
-
the normalized live-game lookup behavior of `
|
|
103
|
+
the normalized live-game lookup behavior of `resolvePvPCoinflipGame()`.
|
|
98
104
|
|
|
99
105
|
- 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
106
|
|
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.
|
package/dist/index.cjs
CHANGED
|
@@ -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
|
@@ -243,7 +243,7 @@ declare class SuigarClient {
|
|
|
243
243
|
* The SDK first reads the selected game's settings object from SweetHouse,
|
|
244
244
|
* then reads that game's coin-specific `Parameters<T>` object. Results are
|
|
245
245
|
* cached according to the extension `cacheTtl` option. Pass
|
|
246
|
-
* `ignoreCache: true` to refresh the
|
|
246
|
+
* `ignoreCache: true` to refresh the on-chain read and replace the cached
|
|
247
247
|
* value.
|
|
248
248
|
*
|
|
249
249
|
* @param game Game whose parameters should be loaded.
|
|
@@ -253,7 +253,7 @@ declare class SuigarClient {
|
|
|
253
253
|
getGameParameters<TGame extends Game>(game: TGame, options?: GetGameParametersOptions): Promise<GameParameters<TGame>>;
|
|
254
254
|
/**
|
|
255
255
|
* Lists unresolved PvP coinflip games from the configured registry and resolves
|
|
256
|
-
* each entry into parsed
|
|
256
|
+
* each entry into parsed on-chain game state.
|
|
257
257
|
*
|
|
258
258
|
* This fetches dynamic fields from the PvP coinflip registry object, then bulk
|
|
259
259
|
* loads the referenced game objects through `client.core.getObjects()`. Registry
|
package/dist/index.d.ts
CHANGED
|
@@ -243,7 +243,7 @@ declare class SuigarClient {
|
|
|
243
243
|
* The SDK first reads the selected game's settings object from SweetHouse,
|
|
244
244
|
* then reads that game's coin-specific `Parameters<T>` object. Results are
|
|
245
245
|
* cached according to the extension `cacheTtl` option. Pass
|
|
246
|
-
* `ignoreCache: true` to refresh the
|
|
246
|
+
* `ignoreCache: true` to refresh the on-chain read and replace the cached
|
|
247
247
|
* value.
|
|
248
248
|
*
|
|
249
249
|
* @param game Game whose parameters should be loaded.
|
|
@@ -253,7 +253,7 @@ declare class SuigarClient {
|
|
|
253
253
|
getGameParameters<TGame extends Game>(game: TGame, options?: GetGameParametersOptions): Promise<GameParameters<TGame>>;
|
|
254
254
|
/**
|
|
255
255
|
* Lists unresolved PvP coinflip games from the configured registry and resolves
|
|
256
|
-
* each entry into parsed
|
|
256
|
+
* each entry into parsed on-chain game state.
|
|
257
257
|
*
|
|
258
258
|
* This fetches dynamic fields from the PvP coinflip registry object, then bulk
|
|
259
259
|
* loads the referenced game objects through `client.core.getObjects()`. Registry
|
package/dist/index.js
CHANGED
|
@@ -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.
|