@suigar/sdk 2.0.0-beta.1 → 2.0.0-beta.10

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/dist/utils.cjs ADDED
@@ -0,0 +1,230 @@
1
+ 'use strict';
2
+
3
+ var utils = require('@mysten/sui/utils');
4
+ var bcs = require('@mysten/sui/bcs');
5
+ require('@mysten/sui/transactions');
6
+
7
+ // src/utils/constants.ts
8
+ var DEFAULT_GAS_BUDGET_MIST = utils.parseToMist("0.05");
9
+ var DEFAULT_RANGE_SCALE = 1e6;
10
+ var RANGE_POINT_LIMIT = DEFAULT_RANGE_SCALE * 100;
11
+ var DEFAULT_LIMBO_MULTIPLIER_SCALE = 100;
12
+
13
+ // src/utils/numeric.ts
14
+ function isFiniteNumber(value, message) {
15
+ if (typeof value !== "number") {
16
+ throw new Error(`${message}: ${String(value)}`);
17
+ }
18
+ if (!Number.isFinite(value)) {
19
+ throw new Error(`Value must be a finite number: ${value}`);
20
+ }
21
+ }
22
+ function toBigInt(value) {
23
+ if (typeof value === "bigint") {
24
+ if (value < 0n) {
25
+ throw new Error(`Value must be non-negative: ${value}`);
26
+ }
27
+ return value;
28
+ }
29
+ isFiniteNumber(value, "Value must be a bigint or number");
30
+ if (value < 0) {
31
+ throw new Error(`Value must be a finite non-negative number: ${value}`);
32
+ }
33
+ return BigInt(Math.trunc(value));
34
+ }
35
+ function toU8(value) {
36
+ isFiniteNumber(value, "Value must be a number");
37
+ if (!Number.isInteger(value)) {
38
+ throw new Error(`Value must be an integer: ${value}`);
39
+ }
40
+ if (value < 0 || value > 255) {
41
+ throw new Error(`Value must be an integer between 0 and 255: ${value}`);
42
+ }
43
+ return value;
44
+ }
45
+ utils.normalizeSuiAddress("0x1");
46
+ utils.normalizeSuiAddress("0x2");
47
+ var MoveStruct = class extends bcs.BcsStruct {
48
+ async get({
49
+ objectId,
50
+ ...options
51
+ }) {
52
+ const [res] = await this.getMany({
53
+ ...options,
54
+ objectIds: [objectId]
55
+ });
56
+ if (!res) {
57
+ throw new Error(`No object found for id ${objectId}`);
58
+ }
59
+ return res;
60
+ }
61
+ async getMany({
62
+ client,
63
+ ...options
64
+ }) {
65
+ const response = await client.core.getObjects({
66
+ ...options,
67
+ include: {
68
+ ...options.include,
69
+ content: true
70
+ }
71
+ });
72
+ return response.objects.map((obj) => {
73
+ if (obj instanceof Error) {
74
+ throw obj;
75
+ }
76
+ return {
77
+ ...obj,
78
+ json: this.parse(obj.content)
79
+ };
80
+ });
81
+ }
82
+ };
83
+ var $moduleName = "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64";
84
+ var I64 = new MoveStruct({
85
+ name: `${$moduleName}::I64`,
86
+ fields: {
87
+ bits: bcs.bcs.u64()
88
+ }
89
+ });
90
+
91
+ // src/contracts/core/float.ts
92
+ var $moduleName2 = "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float";
93
+ var Float = new MoveStruct({
94
+ name: `${$moduleName2}::Float`,
95
+ fields: {
96
+ is_negative: bcs.bcs.bool(),
97
+ exp: I64,
98
+ mant: bcs.bcs.u64()
99
+ }
100
+ });
101
+
102
+ // src/types/game-details.type.ts
103
+ var COINFLIP_GAME_DETAILS_SCHEMA = {
104
+ player_bet: "string",
105
+ coin_outcome: "string"
106
+ };
107
+ var PVP_COINFLIP_GAME_DETAILS_SCHEMA = {
108
+ pvp_result: "string"
109
+ };
110
+ var LIMBO_GAME_DETAILS_SCHEMA = {
111
+ payout_amount: "u64",
112
+ win: "bool",
113
+ roll_multiplier: "float",
114
+ payout_multiplier: "float",
115
+ target_multiplier: "float",
116
+ actual_rtp: "float"
117
+ };
118
+ var RANGE_GAME_DETAILS_SCHEMA = {
119
+ roll_value: "u64",
120
+ win: "bool",
121
+ payout_amount: "u64",
122
+ payout_multiplier: "float",
123
+ left_point: "u64",
124
+ right_point: "u64",
125
+ zone_size: "u64",
126
+ winning_zone_size: "u64",
127
+ is_out_range: "bool",
128
+ bet_threshold: "u64",
129
+ roll_under: "bool",
130
+ range_mode: "u8",
131
+ win_probability: "float",
132
+ win_multiplier: "float",
133
+ actual_rtp: "float"
134
+ };
135
+ var PLINKO_GAME_DETAILS_SCHEMA = {
136
+ slot_index: "u8",
137
+ multiplier: "float",
138
+ payout_amount: "u64",
139
+ plinko_config: "u8"
140
+ };
141
+ var WHEEL_GAME_DETAILS_SCHEMA = {
142
+ case_index: "u8",
143
+ multiplier: "float",
144
+ payout_amount: "u64",
145
+ wheel_config: "u8",
146
+ spin_value: "u64"
147
+ };
148
+ var GAME_DETAILS_SCHEMA = {
149
+ ...COINFLIP_GAME_DETAILS_SCHEMA,
150
+ ...PVP_COINFLIP_GAME_DETAILS_SCHEMA,
151
+ ...LIMBO_GAME_DETAILS_SCHEMA,
152
+ ...RANGE_GAME_DETAILS_SCHEMA,
153
+ ...PLINKO_GAME_DETAILS_SCHEMA,
154
+ ...WHEEL_GAME_DETAILS_SCHEMA
155
+ };
156
+
157
+ // src/utils/parser.ts
158
+ var textDecoder = new TextDecoder();
159
+ var GAME_DETAIL_BCS = {
160
+ u8: bcs.bcs.U8,
161
+ u64: bcs.bcs.U64,
162
+ bool: bcs.bcs.Bool,
163
+ float: Float,
164
+ string: bcs.bcs.String
165
+ };
166
+ function fromMoveI64(i64) {
167
+ try {
168
+ return Number(BigInt.asIntN(64, BigInt(i64.bits ?? 0)));
169
+ } catch {
170
+ return 0;
171
+ }
172
+ }
173
+ function fromMoveFloat(float) {
174
+ const mantissa = BigInt(float.mant ?? 0);
175
+ if (mantissa === 0n) {
176
+ return 0;
177
+ }
178
+ const exponent = fromMoveI64(float.exp) - 52;
179
+ const magnitude = Number(mantissa) * 2 ** exponent;
180
+ return float.is_negative ? -magnitude : magnitude;
181
+ }
182
+ function parseCoinType(type) {
183
+ const coinType = utils.parseStructTag(type).typeParams[0];
184
+ if (!coinType) {
185
+ throw new Error(`Unable to parse coin type from ${type}`);
186
+ }
187
+ return utils.normalizeStructTag(coinType);
188
+ }
189
+ function normalizeGameDetailValue(valueType, parsed) {
190
+ if (valueType === "float") {
191
+ return fromMoveFloat(parsed);
192
+ }
193
+ if (valueType === "u64") {
194
+ return Number(parsed);
195
+ }
196
+ return parsed;
197
+ }
198
+ function parseStringGameDetail(value) {
199
+ const bytes = Uint8Array.from(value);
200
+ try {
201
+ return bcs.bcs.String.parse(bytes);
202
+ } catch {
203
+ return textDecoder.decode(bytes);
204
+ }
205
+ }
206
+ function parseGameDetail(valueType, value) {
207
+ if (valueType === "string") {
208
+ return parseStringGameDetail(value);
209
+ }
210
+ const parsed = GAME_DETAIL_BCS[valueType].parse(Uint8Array.from(value));
211
+ return normalizeGameDetailValue(valueType, parsed);
212
+ }
213
+ function parseGameDetails(gameDetails) {
214
+ return gameDetails.contents.reduce((details, entry) => {
215
+ const valueType = GAME_DETAILS_SCHEMA[entry.key] ?? "string";
216
+ details[entry.key] = parseGameDetail(valueType, entry.value);
217
+ return details;
218
+ }, {});
219
+ }
220
+
221
+ exports.DEFAULT_GAS_BUDGET_MIST = DEFAULT_GAS_BUDGET_MIST;
222
+ exports.DEFAULT_LIMBO_MULTIPLIER_SCALE = DEFAULT_LIMBO_MULTIPLIER_SCALE;
223
+ exports.DEFAULT_RANGE_SCALE = DEFAULT_RANGE_SCALE;
224
+ exports.RANGE_POINT_LIMIT = RANGE_POINT_LIMIT;
225
+ exports.fromMoveFloat = fromMoveFloat;
226
+ exports.fromMoveI64 = fromMoveI64;
227
+ exports.parseCoinType = parseCoinType;
228
+ exports.parseGameDetails = parseGameDetails;
229
+ exports.toBigInt = toBigInt;
230
+ exports.toU8 = toU8;
@@ -0,0 +1,148 @@
1
+ import * as _mysten_bcs from '@mysten/bcs';
2
+ import { M as MoveStruct } from './index-3P_LBbDM.cjs';
3
+ import '@mysten/sui/bcs';
4
+ import '@mysten/sui/client';
5
+
6
+ declare const BetResultEvent: MoveStruct<{
7
+ player: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
8
+ coin_type: MoveStruct<{
9
+ name: _mysten_bcs.BcsType<string, string, "string">;
10
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
11
+ stake_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
12
+ unsafe_oracle_usd_coin_price: MoveStruct<{
13
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
14
+ exp: MoveStruct<{
15
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
16
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
17
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
18
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
19
+ adjusted_oracle_usd_coin_price: MoveStruct<{
20
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
21
+ exp: MoveStruct<{
22
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
23
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
24
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
25
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
26
+ outcome_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
27
+ game_details: MoveStruct<{
28
+ contents: _mysten_bcs.BcsType<{
29
+ key: string;
30
+ value: number[];
31
+ }[], Iterable<{
32
+ key: string;
33
+ value: Iterable<number> & {
34
+ length: number;
35
+ };
36
+ }> & {
37
+ length: number;
38
+ }, string>;
39
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
40
+ metadata: MoveStruct<{
41
+ contents: _mysten_bcs.BcsType<{
42
+ key: string;
43
+ value: number[];
44
+ }[], Iterable<{
45
+ key: string;
46
+ value: Iterable<number> & {
47
+ length: number;
48
+ };
49
+ }> & {
50
+ length: number;
51
+ }, string>;
52
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
53
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::core::BetResultEvent<phantom T0>">;
54
+
55
+ type BetResultGameDetails = ReturnType<(typeof BetResultEvent)['parse']>['game_details'];
56
+ type ParsedGameDetailValue = string | number | boolean;
57
+ type ParsedGameDetails = Record<string, ParsedGameDetailValue>;
58
+
59
+ declare const DEFAULT_GAS_BUDGET_MIST: bigint;
60
+ declare const DEFAULT_RANGE_SCALE = 1000000;
61
+ declare const RANGE_POINT_LIMIT: number;
62
+ declare const DEFAULT_LIMBO_MULTIPLIER_SCALE = 100;
63
+
64
+ /**
65
+ * Normalizes a numeric input into a non-negative `bigint`.
66
+ *
67
+ * This helper accepts the two number shapes the SDK commonly sees from app
68
+ * code: plain JavaScript numbers and already-normalized `bigint` values.
69
+ * Number inputs are truncated toward zero before conversion, so UI-friendly
70
+ * values like `5.9` become `5n`.
71
+ *
72
+ * @param value Value to coerce into a `bigint`.
73
+ * @returns The normalized non-negative `bigint`.
74
+ * @throws When `value` is not a finite number or bigint, or when it is negative.
75
+ */
76
+ declare function toBigInt(value: unknown): bigint;
77
+ /**
78
+ * Validates that a value can be safely used as a Move `u8`.
79
+ *
80
+ * Use this for config ids and other small integer fields that must stay inside
81
+ * the `0..255` range. Unlike `toBigInt`, this does not coerce fractional
82
+ * values: the input must already be an integer.
83
+ *
84
+ * @param value Value to validate.
85
+ * @returns The original number once it has been confirmed to be a valid `u8`.
86
+ * @throws When `value` is not a finite integer between `0` and `255`.
87
+ */
88
+ declare function toU8(value: unknown): number;
89
+
90
+ declare const Float: MoveStruct<{
91
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
92
+ exp: MoveStruct<{
93
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
94
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
95
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
96
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
97
+
98
+ type MoveFloat = ReturnType<(typeof Float)['parse']>;
99
+ /**
100
+ * Converts a generated Move `i64` wrapper into a JavaScript number.
101
+ *
102
+ * The generated bindings expose signed 64-bit integers through a `{ bits }`
103
+ * field that stores the raw two's-complement bit pattern. This helper
104
+ * reinterprets those bits as a signed `i64` and returns a plain JS number.
105
+ * Invalid or missing input falls back to `0`.
106
+ *
107
+ * @param i64 Generated Move `i64` value, typically used for float exponents.
108
+ * @returns The signed 64-bit value as a JavaScript number.
109
+ */
110
+ declare function fromMoveI64(i64: MoveFloat['exp']): number;
111
+ /**
112
+ * Converts a generated Move `Float` struct into a JavaScript number.
113
+ *
114
+ * Suigar float values are represented as a sign flag, an unsigned mantissa,
115
+ * and a Move `i64` exponent. This helper rebuilds the numeric value using the
116
+ * same normalization expected by the onchain format and applies the sign at
117
+ * the end. Missing mantissas are treated as `0`, and a zero mantissa returns `0`.
118
+ *
119
+ * @param float Generated Move float value with `mant`, `exp`, and `is_negative`.
120
+ * @returns The decoded floating-point value as a JavaScript number.
121
+ */
122
+ declare function fromMoveFloat(float: MoveFloat): number;
123
+ /**
124
+ * Extracts and normalizes the first generic coin type from a Move object type.
125
+ *
126
+ * PvP game object types encode the wager coin as their first type parameter,
127
+ * for example `Game<0x2::sui::SUI>`. This helper converts that generic type
128
+ * argument into the SDK's canonical struct tag string.
129
+ *
130
+ * @param type Fully qualified Move object type with the coin type as its first generic argument.
131
+ * @returns Normalized coin type struct tag.
132
+ */
133
+ declare function parseCoinType(type: string): string;
134
+ /**
135
+ * Decodes `BetResultEvent.game_details` into plain application values.
136
+ *
137
+ * Suigar stores game detail entries as `VecMap<string, vector<u8>>`, so raw BCS
138
+ * decoding leaves each value as bytes. This helper looks up the known schema for
139
+ * each key, parses the bytes into the expected runtime type, and preserves the
140
+ * original onchain keys in the returned object. Unknown keys fall back to
141
+ * string decoding so newer detail fields remain readable by default.
142
+ *
143
+ * @param gameDetails Raw `game_details` map from a decoded bet result event.
144
+ * @returns A plain object with the same keys and decoded string, number, or boolean values.
145
+ */
146
+ declare function parseGameDetails(gameDetails: BetResultGameDetails): ParsedGameDetails;
147
+
148
+ export { DEFAULT_GAS_BUDGET_MIST, DEFAULT_LIMBO_MULTIPLIER_SCALE, DEFAULT_RANGE_SCALE, RANGE_POINT_LIMIT, fromMoveFloat, fromMoveI64, parseCoinType, parseGameDetails, toBigInt, toU8 };
@@ -0,0 +1,148 @@
1
+ import * as _mysten_bcs from '@mysten/bcs';
2
+ import { M as MoveStruct } from './index-3P_LBbDM.js';
3
+ import '@mysten/sui/bcs';
4
+ import '@mysten/sui/client';
5
+
6
+ declare const BetResultEvent: MoveStruct<{
7
+ player: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
8
+ coin_type: MoveStruct<{
9
+ name: _mysten_bcs.BcsType<string, string, "string">;
10
+ }, "0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName">;
11
+ stake_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
12
+ unsafe_oracle_usd_coin_price: MoveStruct<{
13
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
14
+ exp: MoveStruct<{
15
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
16
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
17
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
18
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
19
+ adjusted_oracle_usd_coin_price: MoveStruct<{
20
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
21
+ exp: MoveStruct<{
22
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
23
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
24
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
25
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
26
+ outcome_amount: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
27
+ game_details: MoveStruct<{
28
+ contents: _mysten_bcs.BcsType<{
29
+ key: string;
30
+ value: number[];
31
+ }[], Iterable<{
32
+ key: string;
33
+ value: Iterable<number> & {
34
+ length: number;
35
+ };
36
+ }> & {
37
+ length: number;
38
+ }, string>;
39
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
40
+ metadata: MoveStruct<{
41
+ contents: _mysten_bcs.BcsType<{
42
+ key: string;
43
+ value: number[];
44
+ }[], Iterable<{
45
+ key: string;
46
+ value: Iterable<number> & {
47
+ length: number;
48
+ };
49
+ }> & {
50
+ length: number;
51
+ }, string>;
52
+ }, "0x2::vec_map::VecMap<string, vector<u8>>">;
53
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::core::BetResultEvent<phantom T0>">;
54
+
55
+ type BetResultGameDetails = ReturnType<(typeof BetResultEvent)['parse']>['game_details'];
56
+ type ParsedGameDetailValue = string | number | boolean;
57
+ type ParsedGameDetails = Record<string, ParsedGameDetailValue>;
58
+
59
+ declare const DEFAULT_GAS_BUDGET_MIST: bigint;
60
+ declare const DEFAULT_RANGE_SCALE = 1000000;
61
+ declare const RANGE_POINT_LIMIT: number;
62
+ declare const DEFAULT_LIMBO_MULTIPLIER_SCALE = 100;
63
+
64
+ /**
65
+ * Normalizes a numeric input into a non-negative `bigint`.
66
+ *
67
+ * This helper accepts the two number shapes the SDK commonly sees from app
68
+ * code: plain JavaScript numbers and already-normalized `bigint` values.
69
+ * Number inputs are truncated toward zero before conversion, so UI-friendly
70
+ * values like `5.9` become `5n`.
71
+ *
72
+ * @param value Value to coerce into a `bigint`.
73
+ * @returns The normalized non-negative `bigint`.
74
+ * @throws When `value` is not a finite number or bigint, or when it is negative.
75
+ */
76
+ declare function toBigInt(value: unknown): bigint;
77
+ /**
78
+ * Validates that a value can be safely used as a Move `u8`.
79
+ *
80
+ * Use this for config ids and other small integer fields that must stay inside
81
+ * the `0..255` range. Unlike `toBigInt`, this does not coerce fractional
82
+ * values: the input must already be an integer.
83
+ *
84
+ * @param value Value to validate.
85
+ * @returns The original number once it has been confirmed to be a valid `u8`.
86
+ * @throws When `value` is not a finite integer between `0` and `255`.
87
+ */
88
+ declare function toU8(value: unknown): number;
89
+
90
+ declare const Float: MoveStruct<{
91
+ is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
92
+ exp: MoveStruct<{
93
+ bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
94
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
95
+ mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
96
+ }, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
97
+
98
+ type MoveFloat = ReturnType<(typeof Float)['parse']>;
99
+ /**
100
+ * Converts a generated Move `i64` wrapper into a JavaScript number.
101
+ *
102
+ * The generated bindings expose signed 64-bit integers through a `{ bits }`
103
+ * field that stores the raw two's-complement bit pattern. This helper
104
+ * reinterprets those bits as a signed `i64` and returns a plain JS number.
105
+ * Invalid or missing input falls back to `0`.
106
+ *
107
+ * @param i64 Generated Move `i64` value, typically used for float exponents.
108
+ * @returns The signed 64-bit value as a JavaScript number.
109
+ */
110
+ declare function fromMoveI64(i64: MoveFloat['exp']): number;
111
+ /**
112
+ * Converts a generated Move `Float` struct into a JavaScript number.
113
+ *
114
+ * Suigar float values are represented as a sign flag, an unsigned mantissa,
115
+ * and a Move `i64` exponent. This helper rebuilds the numeric value using the
116
+ * same normalization expected by the onchain format and applies the sign at
117
+ * the end. Missing mantissas are treated as `0`, and a zero mantissa returns `0`.
118
+ *
119
+ * @param float Generated Move float value with `mant`, `exp`, and `is_negative`.
120
+ * @returns The decoded floating-point value as a JavaScript number.
121
+ */
122
+ declare function fromMoveFloat(float: MoveFloat): number;
123
+ /**
124
+ * Extracts and normalizes the first generic coin type from a Move object type.
125
+ *
126
+ * PvP game object types encode the wager coin as their first type parameter,
127
+ * for example `Game<0x2::sui::SUI>`. This helper converts that generic type
128
+ * argument into the SDK's canonical struct tag string.
129
+ *
130
+ * @param type Fully qualified Move object type with the coin type as its first generic argument.
131
+ * @returns Normalized coin type struct tag.
132
+ */
133
+ declare function parseCoinType(type: string): string;
134
+ /**
135
+ * Decodes `BetResultEvent.game_details` into plain application values.
136
+ *
137
+ * Suigar stores game detail entries as `VecMap<string, vector<u8>>`, so raw BCS
138
+ * decoding leaves each value as bytes. This helper looks up the known schema for
139
+ * each key, parses the bytes into the expected runtime type, and preserves the
140
+ * original onchain keys in the returned object. Unknown keys fall back to
141
+ * string decoding so newer detail fields remain readable by default.
142
+ *
143
+ * @param gameDetails Raw `game_details` map from a decoded bet result event.
144
+ * @returns A plain object with the same keys and decoded string, number, or boolean values.
145
+ */
146
+ declare function parseGameDetails(gameDetails: BetResultGameDetails): ParsedGameDetails;
147
+
148
+ export { DEFAULT_GAS_BUDGET_MIST, DEFAULT_LIMBO_MULTIPLIER_SCALE, DEFAULT_RANGE_SCALE, RANGE_POINT_LIMIT, fromMoveFloat, fromMoveI64, parseCoinType, parseGameDetails, toBigInt, toU8 };
package/dist/utils.js ADDED
@@ -0,0 +1 @@
1
+ export { DEFAULT_GAS_BUDGET_MIST, DEFAULT_LIMBO_MULTIPLIER_SCALE, DEFAULT_RANGE_SCALE, RANGE_POINT_LIMIT, fromMoveFloat, fromMoveI64, parseCoinType, parseGameDetails, toBigInt, toU8 } from './chunk-PPUDLRHA.js';