@suigar/sdk 2.0.0-beta.10 → 2.0.0-beta.12
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 +19 -0
- package/README.md +70 -0
- package/dist/{chunk-PPUDLRHA.js → chunk-7N55D2TV.js} +36 -24
- package/dist/{games-BccpPyWd.d.cts → games-BHYRg31e.d.cts} +13 -1
- package/dist/{games-BccpPyWd.d.ts → games-BHYRg31e.d.ts} +13 -1
- package/dist/games.d.cts +1 -1
- package/dist/games.d.ts +1 -1
- package/dist/index.cjs +470 -35
- package/dist/index.d.cts +217 -6
- package/dist/index.d.ts +217 -6
- package/dist/index.js +440 -14
- package/dist/utils.cjs +36 -23
- package/dist/utils.d.cts +47 -15
- package/dist/utils.d.ts +47 -15
- package/dist/utils.js +1 -1
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,29 +1,226 @@
|
|
|
1
1
|
import { M as MoveStruct } from './index-3P_LBbDM.cjs';
|
|
2
2
|
import * as _mysten_bcs from '@mysten/bcs';
|
|
3
|
-
import {
|
|
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, 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, e as SuigarConfig, W as WithThrowOnError, P as PvPCoinflipAction, f as BuildPvPCoinflipTransactionOptions, g as SuigarExtensionOptions } from './games-BHYRg31e.cjs';
|
|
6
6
|
import '@mysten/sui/bcs';
|
|
7
7
|
|
|
8
8
|
type WithoutConfig<T> = Omit<T, 'config'>;
|
|
9
9
|
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
10
|
|
|
11
|
-
declare
|
|
11
|
+
declare const GAME_SETTINGS: {
|
|
12
|
+
readonly coinflip: {
|
|
13
|
+
readonly settingsKey: MoveStruct<{
|
|
14
|
+
dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
15
|
+
}, "0xb35c5f286c443752afc8ccb40125a578a4f32df35617170ccfa17fe180ab80ea::coinflip::CoinFlipSettingsKey">;
|
|
16
|
+
readonly parameters: MoveStruct<{
|
|
17
|
+
id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
18
|
+
house_edge: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
19
|
+
min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
20
|
+
max_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
21
|
+
}, "0xb35c5f286c443752afc8ccb40125a578a4f32df35617170ccfa17fe180ab80ea::coinflip::Parameters<phantom T0>">;
|
|
22
|
+
};
|
|
23
|
+
readonly limbo: {
|
|
24
|
+
readonly settingsKey: MoveStruct<{
|
|
25
|
+
dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
26
|
+
}, "0x96c7841b9b32c59a219760fd656f1c3aceb53cc74a68ec9844a3a696374309f4::limbo::LimboSettingsKey">;
|
|
27
|
+
readonly parameters: MoveStruct<{
|
|
28
|
+
id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
29
|
+
min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
30
|
+
max_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
31
|
+
max_payout: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
32
|
+
min_target_multiplier: MoveStruct<{
|
|
33
|
+
is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
34
|
+
exp: MoveStruct<{
|
|
35
|
+
bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
36
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
|
|
37
|
+
mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
38
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
|
|
39
|
+
max_target_multiplier: MoveStruct<{
|
|
40
|
+
is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
41
|
+
exp: MoveStruct<{
|
|
42
|
+
bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
43
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
|
|
44
|
+
mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
45
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
|
|
46
|
+
max_number_of_games: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
47
|
+
min_rtp: MoveStruct<{
|
|
48
|
+
is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
49
|
+
exp: MoveStruct<{
|
|
50
|
+
bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
51
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
|
|
52
|
+
mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
53
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
|
|
54
|
+
max_rtp: MoveStruct<{
|
|
55
|
+
is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
56
|
+
exp: MoveStruct<{
|
|
57
|
+
bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
58
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
|
|
59
|
+
mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
60
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
|
|
61
|
+
}, "0x96c7841b9b32c59a219760fd656f1c3aceb53cc74a68ec9844a3a696374309f4::limbo::Parameters<phantom T0>">;
|
|
62
|
+
};
|
|
63
|
+
readonly plinko: {
|
|
64
|
+
readonly settingsKey: MoveStruct<{
|
|
65
|
+
dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
66
|
+
}, "0xd3dd2200883af10811724f0bed97591ad155a02efd6332d471ff8b346030dfb7::plinko::PlinkoSettingsKey">;
|
|
67
|
+
readonly parameters: MoveStruct<{
|
|
68
|
+
id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
69
|
+
min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
70
|
+
max_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
71
|
+
max_number_of_balls: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
72
|
+
configs: MoveStruct<{
|
|
73
|
+
contents: _mysten_bcs.BcsType<{
|
|
74
|
+
key: number;
|
|
75
|
+
value: {
|
|
76
|
+
num_rows: number;
|
|
77
|
+
multipliers: {
|
|
78
|
+
is_negative: boolean;
|
|
79
|
+
exp: {
|
|
80
|
+
bits: string;
|
|
81
|
+
};
|
|
82
|
+
mant: string;
|
|
83
|
+
}[];
|
|
84
|
+
min_stake: string;
|
|
85
|
+
max_stake: string;
|
|
86
|
+
is_playable: boolean;
|
|
87
|
+
};
|
|
88
|
+
}[], Iterable<{
|
|
89
|
+
key: number;
|
|
90
|
+
value: {
|
|
91
|
+
num_rows: number;
|
|
92
|
+
multipliers: Iterable<{
|
|
93
|
+
is_negative: boolean;
|
|
94
|
+
exp: {
|
|
95
|
+
bits: string | number | bigint;
|
|
96
|
+
};
|
|
97
|
+
mant: string | number | bigint;
|
|
98
|
+
}> & {
|
|
99
|
+
length: number;
|
|
100
|
+
};
|
|
101
|
+
min_stake: string | number | bigint;
|
|
102
|
+
max_stake: string | number | bigint;
|
|
103
|
+
is_playable: boolean;
|
|
104
|
+
};
|
|
105
|
+
}> & {
|
|
106
|
+
length: number;
|
|
107
|
+
}, string>;
|
|
108
|
+
}, "0x2::vec_map::VecMap<u8, 0xd3dd2200883af10811724f0bed97591ad155a02efd6332d471ff8b346030dfb7::plinko::PlinkoConfig>">;
|
|
109
|
+
}, "0xd3dd2200883af10811724f0bed97591ad155a02efd6332d471ff8b346030dfb7::plinko::Parameters<phantom T0>">;
|
|
110
|
+
};
|
|
111
|
+
readonly 'pvp-coinflip': {
|
|
112
|
+
readonly settingsKey: MoveStruct<{
|
|
113
|
+
dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
114
|
+
}, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::PvpCoinflipSettingsKey">;
|
|
115
|
+
readonly parameters: MoveStruct<{
|
|
116
|
+
id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
117
|
+
house_edge_bps: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
118
|
+
min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
119
|
+
}, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::Parameters<phantom T0>">;
|
|
120
|
+
};
|
|
121
|
+
readonly range: {
|
|
122
|
+
readonly settingsKey: MoveStruct<{
|
|
123
|
+
dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
124
|
+
}, "0x096a4cf18b3661e76b2c62b90785418345d52f45b272448794f123a4cb6b6416::range::RangeSettingsKey">;
|
|
125
|
+
readonly parameters: MoveStruct<{
|
|
126
|
+
id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
127
|
+
min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
128
|
+
max_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
129
|
+
min_zone_size: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
130
|
+
max_zone_size: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
131
|
+
max_number_of_games: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
132
|
+
min_rtp: MoveStruct<{
|
|
133
|
+
is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
134
|
+
exp: MoveStruct<{
|
|
135
|
+
bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
136
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
|
|
137
|
+
mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
138
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
|
|
139
|
+
max_rtp: MoveStruct<{
|
|
140
|
+
is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
141
|
+
exp: MoveStruct<{
|
|
142
|
+
bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
143
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
|
|
144
|
+
mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
145
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
|
|
146
|
+
}, "0x096a4cf18b3661e76b2c62b90785418345d52f45b272448794f123a4cb6b6416::range::Parameters<phantom T0>">;
|
|
147
|
+
};
|
|
148
|
+
readonly wheel: {
|
|
149
|
+
readonly settingsKey: MoveStruct<{
|
|
150
|
+
dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
151
|
+
}, "0x0997852ded7e13301c42317004bc49704a893aa82997c5706cebee59053a31b7::wheel::WheelSettingsKey">;
|
|
152
|
+
readonly parameters: MoveStruct<{
|
|
153
|
+
id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
154
|
+
min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
155
|
+
max_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
156
|
+
max_number_of_spins: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
157
|
+
configs: MoveStruct<{
|
|
158
|
+
contents: _mysten_bcs.BcsType<{
|
|
159
|
+
key: number;
|
|
160
|
+
value: {
|
|
161
|
+
num_cases: number;
|
|
162
|
+
multipliers: {
|
|
163
|
+
is_negative: boolean;
|
|
164
|
+
exp: {
|
|
165
|
+
bits: string;
|
|
166
|
+
};
|
|
167
|
+
mant: string;
|
|
168
|
+
}[];
|
|
169
|
+
min_stake: string;
|
|
170
|
+
max_stake: string;
|
|
171
|
+
is_playable: boolean;
|
|
172
|
+
};
|
|
173
|
+
}[], Iterable<{
|
|
174
|
+
key: number;
|
|
175
|
+
value: {
|
|
176
|
+
num_cases: number;
|
|
177
|
+
multipliers: Iterable<{
|
|
178
|
+
is_negative: boolean;
|
|
179
|
+
exp: {
|
|
180
|
+
bits: string | number | bigint;
|
|
181
|
+
};
|
|
182
|
+
mant: string | number | bigint;
|
|
183
|
+
}> & {
|
|
184
|
+
length: number;
|
|
185
|
+
};
|
|
186
|
+
min_stake: string | number | bigint;
|
|
187
|
+
max_stake: string | number | bigint;
|
|
188
|
+
is_playable: boolean;
|
|
189
|
+
};
|
|
190
|
+
}> & {
|
|
191
|
+
length: number;
|
|
192
|
+
}, string>;
|
|
193
|
+
}, "0x2::vec_map::VecMap<u8, 0x0997852ded7e13301c42317004bc49704a893aa82997c5706cebee59053a31b7::wheel::WheelConfig>">;
|
|
194
|
+
}, "0x0997852ded7e13301c42317004bc49704a893aa82997c5706cebee59053a31b7::wheel::Parameters<phantom T0>">;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
type GameParametersMap = {
|
|
198
|
+
[TGame in Game]: ReturnType<(typeof GAME_SETTINGS)[TGame]['parameters']['parse']>;
|
|
199
|
+
};
|
|
200
|
+
type GameParameters<TGame extends Game> = GameParametersMap[TGame];
|
|
201
|
+
type GetGameParametersOptions = SuiClientTypes.CoreClientMethodOptions & {
|
|
202
|
+
coinType?: string;
|
|
203
|
+
ignoreCache?: boolean;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
declare function suigar<const Name = 'suigar'>({ name, partner, cacheTtl, }?: SuigarExtensionOptions<Name>): {
|
|
12
207
|
name: Name;
|
|
13
208
|
register: (client: ClientWithCoreApi) => SuigarClient;
|
|
14
209
|
};
|
|
15
210
|
declare class SuigarClient {
|
|
16
211
|
#private;
|
|
17
|
-
constructor({ client, partner, }: {
|
|
212
|
+
constructor({ client, name, partner, cacheTtl, }: {
|
|
18
213
|
client: ClientWithCoreApi;
|
|
214
|
+
name: string;
|
|
19
215
|
partner?: string;
|
|
216
|
+
cacheTtl?: number;
|
|
20
217
|
});
|
|
21
218
|
/**
|
|
22
219
|
* Returns the resolved SDK configuration for the connected network.
|
|
23
220
|
*
|
|
24
221
|
* This is primarily useful for debugging or inspecting which package ids,
|
|
25
|
-
* supported coin types, and price info object ids the SDK
|
|
26
|
-
* current client network.
|
|
222
|
+
* registry ids, supported coin types, and price info object ids the SDK
|
|
223
|
+
* resolved for the current client network.
|
|
27
224
|
*
|
|
28
225
|
* @returns Network-resolved Suigar configuration.
|
|
29
226
|
*/
|
|
@@ -40,6 +237,20 @@ declare class SuigarClient {
|
|
|
40
237
|
* @returns Base64-encoded transaction bytes ready to send over the wire.
|
|
41
238
|
*/
|
|
42
239
|
serializeTransactionToBase64(transaction: Transaction, options?: Omit<BuildTransactionOptions, 'client'>): Promise<string>;
|
|
240
|
+
/**
|
|
241
|
+
* Reads on-chain game parameters for the requested game.
|
|
242
|
+
*
|
|
243
|
+
* The SDK first reads the selected game's settings object from SweetHouse,
|
|
244
|
+
* then reads that game's coin-specific `Parameters<T>` object. Results are
|
|
245
|
+
* cached according to the extension `cacheTtl` option. Pass
|
|
246
|
+
* `ignoreCache: true` to refresh the onchain read and replace the cached
|
|
247
|
+
* value.
|
|
248
|
+
*
|
|
249
|
+
* @param game Game whose parameters should be loaded.
|
|
250
|
+
* @param options Optional coin type, cache override, and abort signal.
|
|
251
|
+
* @returns Parsed game parameters typed for the requested game.
|
|
252
|
+
*/
|
|
253
|
+
getGameParameters<TGame extends Game>(game: TGame, options?: GetGameParametersOptions): Promise<GameParameters<TGame>>;
|
|
43
254
|
/**
|
|
44
255
|
* Lists unresolved PvP coinflip games from the configured registry and resolves
|
|
45
256
|
* each entry into parsed onchain game state.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,29 +1,226 @@
|
|
|
1
1
|
import { M as MoveStruct } from './index-3P_LBbDM.js';
|
|
2
2
|
import * as _mysten_bcs from '@mysten/bcs';
|
|
3
|
-
import {
|
|
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, 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, e as SuigarConfig, W as WithThrowOnError, P as PvPCoinflipAction, f as BuildPvPCoinflipTransactionOptions, g as SuigarExtensionOptions } from './games-BHYRg31e.js';
|
|
6
6
|
import '@mysten/sui/bcs';
|
|
7
7
|
|
|
8
8
|
type WithoutConfig<T> = Omit<T, 'config'>;
|
|
9
9
|
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
10
|
|
|
11
|
-
declare
|
|
11
|
+
declare const GAME_SETTINGS: {
|
|
12
|
+
readonly coinflip: {
|
|
13
|
+
readonly settingsKey: MoveStruct<{
|
|
14
|
+
dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
15
|
+
}, "0xb35c5f286c443752afc8ccb40125a578a4f32df35617170ccfa17fe180ab80ea::coinflip::CoinFlipSettingsKey">;
|
|
16
|
+
readonly parameters: MoveStruct<{
|
|
17
|
+
id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
18
|
+
house_edge: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
19
|
+
min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
20
|
+
max_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
21
|
+
}, "0xb35c5f286c443752afc8ccb40125a578a4f32df35617170ccfa17fe180ab80ea::coinflip::Parameters<phantom T0>">;
|
|
22
|
+
};
|
|
23
|
+
readonly limbo: {
|
|
24
|
+
readonly settingsKey: MoveStruct<{
|
|
25
|
+
dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
26
|
+
}, "0x96c7841b9b32c59a219760fd656f1c3aceb53cc74a68ec9844a3a696374309f4::limbo::LimboSettingsKey">;
|
|
27
|
+
readonly parameters: MoveStruct<{
|
|
28
|
+
id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
29
|
+
min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
30
|
+
max_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
31
|
+
max_payout: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
32
|
+
min_target_multiplier: MoveStruct<{
|
|
33
|
+
is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
34
|
+
exp: MoveStruct<{
|
|
35
|
+
bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
36
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
|
|
37
|
+
mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
38
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
|
|
39
|
+
max_target_multiplier: MoveStruct<{
|
|
40
|
+
is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
41
|
+
exp: MoveStruct<{
|
|
42
|
+
bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
43
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
|
|
44
|
+
mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
45
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
|
|
46
|
+
max_number_of_games: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
47
|
+
min_rtp: MoveStruct<{
|
|
48
|
+
is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
49
|
+
exp: MoveStruct<{
|
|
50
|
+
bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
51
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
|
|
52
|
+
mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
53
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
|
|
54
|
+
max_rtp: MoveStruct<{
|
|
55
|
+
is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
56
|
+
exp: MoveStruct<{
|
|
57
|
+
bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
58
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
|
|
59
|
+
mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
60
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
|
|
61
|
+
}, "0x96c7841b9b32c59a219760fd656f1c3aceb53cc74a68ec9844a3a696374309f4::limbo::Parameters<phantom T0>">;
|
|
62
|
+
};
|
|
63
|
+
readonly plinko: {
|
|
64
|
+
readonly settingsKey: MoveStruct<{
|
|
65
|
+
dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
66
|
+
}, "0xd3dd2200883af10811724f0bed97591ad155a02efd6332d471ff8b346030dfb7::plinko::PlinkoSettingsKey">;
|
|
67
|
+
readonly parameters: MoveStruct<{
|
|
68
|
+
id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
69
|
+
min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
70
|
+
max_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
71
|
+
max_number_of_balls: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
72
|
+
configs: MoveStruct<{
|
|
73
|
+
contents: _mysten_bcs.BcsType<{
|
|
74
|
+
key: number;
|
|
75
|
+
value: {
|
|
76
|
+
num_rows: number;
|
|
77
|
+
multipliers: {
|
|
78
|
+
is_negative: boolean;
|
|
79
|
+
exp: {
|
|
80
|
+
bits: string;
|
|
81
|
+
};
|
|
82
|
+
mant: string;
|
|
83
|
+
}[];
|
|
84
|
+
min_stake: string;
|
|
85
|
+
max_stake: string;
|
|
86
|
+
is_playable: boolean;
|
|
87
|
+
};
|
|
88
|
+
}[], Iterable<{
|
|
89
|
+
key: number;
|
|
90
|
+
value: {
|
|
91
|
+
num_rows: number;
|
|
92
|
+
multipliers: Iterable<{
|
|
93
|
+
is_negative: boolean;
|
|
94
|
+
exp: {
|
|
95
|
+
bits: string | number | bigint;
|
|
96
|
+
};
|
|
97
|
+
mant: string | number | bigint;
|
|
98
|
+
}> & {
|
|
99
|
+
length: number;
|
|
100
|
+
};
|
|
101
|
+
min_stake: string | number | bigint;
|
|
102
|
+
max_stake: string | number | bigint;
|
|
103
|
+
is_playable: boolean;
|
|
104
|
+
};
|
|
105
|
+
}> & {
|
|
106
|
+
length: number;
|
|
107
|
+
}, string>;
|
|
108
|
+
}, "0x2::vec_map::VecMap<u8, 0xd3dd2200883af10811724f0bed97591ad155a02efd6332d471ff8b346030dfb7::plinko::PlinkoConfig>">;
|
|
109
|
+
}, "0xd3dd2200883af10811724f0bed97591ad155a02efd6332d471ff8b346030dfb7::plinko::Parameters<phantom T0>">;
|
|
110
|
+
};
|
|
111
|
+
readonly 'pvp-coinflip': {
|
|
112
|
+
readonly settingsKey: MoveStruct<{
|
|
113
|
+
dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
114
|
+
}, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::PvpCoinflipSettingsKey">;
|
|
115
|
+
readonly parameters: MoveStruct<{
|
|
116
|
+
id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
117
|
+
house_edge_bps: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
118
|
+
min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
119
|
+
}, "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip::Parameters<phantom T0>">;
|
|
120
|
+
};
|
|
121
|
+
readonly range: {
|
|
122
|
+
readonly settingsKey: MoveStruct<{
|
|
123
|
+
dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
124
|
+
}, "0x096a4cf18b3661e76b2c62b90785418345d52f45b272448794f123a4cb6b6416::range::RangeSettingsKey">;
|
|
125
|
+
readonly parameters: MoveStruct<{
|
|
126
|
+
id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
127
|
+
min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
128
|
+
max_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
129
|
+
min_zone_size: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
130
|
+
max_zone_size: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
131
|
+
max_number_of_games: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
132
|
+
min_rtp: MoveStruct<{
|
|
133
|
+
is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
134
|
+
exp: MoveStruct<{
|
|
135
|
+
bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
136
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
|
|
137
|
+
mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
138
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
|
|
139
|
+
max_rtp: MoveStruct<{
|
|
140
|
+
is_negative: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
141
|
+
exp: MoveStruct<{
|
|
142
|
+
bits: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
143
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::i64::I64">;
|
|
144
|
+
mant: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
145
|
+
}, "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::float::Float">;
|
|
146
|
+
}, "0x096a4cf18b3661e76b2c62b90785418345d52f45b272448794f123a4cb6b6416::range::Parameters<phantom T0>">;
|
|
147
|
+
};
|
|
148
|
+
readonly wheel: {
|
|
149
|
+
readonly settingsKey: MoveStruct<{
|
|
150
|
+
dummy_field: _mysten_bcs.BcsType<boolean, boolean, "bool">;
|
|
151
|
+
}, "0x0997852ded7e13301c42317004bc49704a893aa82997c5706cebee59053a31b7::wheel::WheelSettingsKey">;
|
|
152
|
+
readonly parameters: MoveStruct<{
|
|
153
|
+
id: _mysten_bcs.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
154
|
+
min_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
155
|
+
max_stake: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
156
|
+
max_number_of_spins: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
|
|
157
|
+
configs: MoveStruct<{
|
|
158
|
+
contents: _mysten_bcs.BcsType<{
|
|
159
|
+
key: number;
|
|
160
|
+
value: {
|
|
161
|
+
num_cases: number;
|
|
162
|
+
multipliers: {
|
|
163
|
+
is_negative: boolean;
|
|
164
|
+
exp: {
|
|
165
|
+
bits: string;
|
|
166
|
+
};
|
|
167
|
+
mant: string;
|
|
168
|
+
}[];
|
|
169
|
+
min_stake: string;
|
|
170
|
+
max_stake: string;
|
|
171
|
+
is_playable: boolean;
|
|
172
|
+
};
|
|
173
|
+
}[], Iterable<{
|
|
174
|
+
key: number;
|
|
175
|
+
value: {
|
|
176
|
+
num_cases: number;
|
|
177
|
+
multipliers: Iterable<{
|
|
178
|
+
is_negative: boolean;
|
|
179
|
+
exp: {
|
|
180
|
+
bits: string | number | bigint;
|
|
181
|
+
};
|
|
182
|
+
mant: string | number | bigint;
|
|
183
|
+
}> & {
|
|
184
|
+
length: number;
|
|
185
|
+
};
|
|
186
|
+
min_stake: string | number | bigint;
|
|
187
|
+
max_stake: string | number | bigint;
|
|
188
|
+
is_playable: boolean;
|
|
189
|
+
};
|
|
190
|
+
}> & {
|
|
191
|
+
length: number;
|
|
192
|
+
}, string>;
|
|
193
|
+
}, "0x2::vec_map::VecMap<u8, 0x0997852ded7e13301c42317004bc49704a893aa82997c5706cebee59053a31b7::wheel::WheelConfig>">;
|
|
194
|
+
}, "0x0997852ded7e13301c42317004bc49704a893aa82997c5706cebee59053a31b7::wheel::Parameters<phantom T0>">;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
type GameParametersMap = {
|
|
198
|
+
[TGame in Game]: ReturnType<(typeof GAME_SETTINGS)[TGame]['parameters']['parse']>;
|
|
199
|
+
};
|
|
200
|
+
type GameParameters<TGame extends Game> = GameParametersMap[TGame];
|
|
201
|
+
type GetGameParametersOptions = SuiClientTypes.CoreClientMethodOptions & {
|
|
202
|
+
coinType?: string;
|
|
203
|
+
ignoreCache?: boolean;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
declare function suigar<const Name = 'suigar'>({ name, partner, cacheTtl, }?: SuigarExtensionOptions<Name>): {
|
|
12
207
|
name: Name;
|
|
13
208
|
register: (client: ClientWithCoreApi) => SuigarClient;
|
|
14
209
|
};
|
|
15
210
|
declare class SuigarClient {
|
|
16
211
|
#private;
|
|
17
|
-
constructor({ client, partner, }: {
|
|
212
|
+
constructor({ client, name, partner, cacheTtl, }: {
|
|
18
213
|
client: ClientWithCoreApi;
|
|
214
|
+
name: string;
|
|
19
215
|
partner?: string;
|
|
216
|
+
cacheTtl?: number;
|
|
20
217
|
});
|
|
21
218
|
/**
|
|
22
219
|
* Returns the resolved SDK configuration for the connected network.
|
|
23
220
|
*
|
|
24
221
|
* This is primarily useful for debugging or inspecting which package ids,
|
|
25
|
-
* supported coin types, and price info object ids the SDK
|
|
26
|
-
* current client network.
|
|
222
|
+
* registry ids, supported coin types, and price info object ids the SDK
|
|
223
|
+
* resolved for the current client network.
|
|
27
224
|
*
|
|
28
225
|
* @returns Network-resolved Suigar configuration.
|
|
29
226
|
*/
|
|
@@ -40,6 +237,20 @@ declare class SuigarClient {
|
|
|
40
237
|
* @returns Base64-encoded transaction bytes ready to send over the wire.
|
|
41
238
|
*/
|
|
42
239
|
serializeTransactionToBase64(transaction: Transaction, options?: Omit<BuildTransactionOptions, 'client'>): Promise<string>;
|
|
240
|
+
/**
|
|
241
|
+
* Reads on-chain game parameters for the requested game.
|
|
242
|
+
*
|
|
243
|
+
* The SDK first reads the selected game's settings object from SweetHouse,
|
|
244
|
+
* then reads that game's coin-specific `Parameters<T>` object. Results are
|
|
245
|
+
* cached according to the extension `cacheTtl` option. Pass
|
|
246
|
+
* `ignoreCache: true` to refresh the onchain read and replace the cached
|
|
247
|
+
* value.
|
|
248
|
+
*
|
|
249
|
+
* @param game Game whose parameters should be loaded.
|
|
250
|
+
* @param options Optional coin type, cache override, and abort signal.
|
|
251
|
+
* @returns Parsed game parameters typed for the requested game.
|
|
252
|
+
*/
|
|
253
|
+
getGameParameters<TGame extends Game>(game: TGame, options?: GetGameParametersOptions): Promise<GameParameters<TGame>>;
|
|
43
254
|
/**
|
|
44
255
|
* Lists unresolved PvP coinflip games from the configured registry and resolves
|
|
45
256
|
* each entry into parsed onchain game state.
|