@scuro/sdk 0.1.0-beta.1

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.
@@ -0,0 +1,11 @@
1
+ import type { BaccaratOutcomeLabel, BaccaratSideLabel, BlackjackActionLabel, BlackjackActionMaskLabel, BlackjackSessionPhaseLabel, GameModeLabel, ModuleStatusLabel, PokerHandPhaseLabel, PokerMatchStateLabel } from "./types";
2
+ export declare function decodeGameMode(value: number | bigint): GameModeLabel;
3
+ export declare function decodeModuleStatus(value: number | bigint): ModuleStatusLabel;
4
+ export declare function decodeBaccaratSide(value: number | bigint): BaccaratSideLabel;
5
+ export declare function decodeBaccaratOutcome(value: number | bigint): BaccaratOutcomeLabel;
6
+ export declare function decodeBlackjackSessionPhase(value: number | bigint): BlackjackSessionPhaseLabel;
7
+ export declare function decodeBlackjackAction(value: number | bigint): BlackjackActionLabel;
8
+ export declare function decodePokerMatchState(value: number | bigint): PokerMatchStateLabel;
9
+ export declare function decodePokerHandPhase(value: number | bigint): PokerHandPhaseLabel;
10
+ export declare function decodeBlackjackActionMask(mask: number | bigint): BlackjackActionMaskLabel[];
11
+ export declare function isPokerPlayerClockPhase(phase: PokerHandPhaseLabel): phase is "PreDrawBetting" | "DrawDeclaration" | "PostDrawBetting";
@@ -0,0 +1,23 @@
1
+ export declare class ScuroSdkError extends Error {
2
+ readonly code: string;
3
+ readonly details?: unknown;
4
+ constructor(code: string, message: string, details?: unknown);
5
+ }
6
+ export declare class MissingDeploymentLabelError extends ScuroSdkError {
7
+ constructor(label: string);
8
+ }
9
+ export declare class UnknownEnumValueError extends ScuroSdkError {
10
+ constructor(enumName: string, value: number | bigint);
11
+ }
12
+ export declare class InvalidLifecycleStateError extends ScuroSdkError {
13
+ constructor(message: string, details?: unknown);
14
+ }
15
+ export declare class ExpiredDeadlineError extends ScuroSdkError {
16
+ constructor(deadlineAt: bigint);
17
+ }
18
+ export declare class MissingWalletClientError extends ScuroSdkError {
19
+ constructor();
20
+ }
21
+ export declare class UnsupportedFactoryFamilyError extends ScuroSdkError {
22
+ constructor(family: string);
23
+ }
@@ -0,0 +1,192 @@
1
+ import type { Abi, Address, Hex, PublicClient, WalletClient } from "viem";
2
+ import type { ContractDeploymentLabel, ContractName, DeploymentOutputLabel } from "../generated/protocol";
3
+ import { deploymentOutputLabelGroups } from "../generated/protocol";
4
+ export type ActorLabel = (typeof deploymentOutputLabelGroups.actors)[number];
5
+ export type ModuleIdLabel = (typeof deploymentOutputLabelGroups.module_ids)[number];
6
+ export type ExpressionLabel = (typeof deploymentOutputLabelGroups.expressions)[number];
7
+ export type BuiltinProfileKey = "anvil-local" | "testnet-beta";
8
+ export interface DeploymentProfile {
9
+ key: string;
10
+ name: string;
11
+ chainId: number;
12
+ rpcUrl?: string;
13
+ labels: Partial<Record<DeploymentOutputLabel, string>>;
14
+ privateKeys?: Partial<Record<ActorLabel | "Admin", Hex>>;
15
+ }
16
+ export interface NormalizedDeployment {
17
+ raw: Partial<Record<DeploymentOutputLabel, string>>;
18
+ contracts: Partial<Record<ContractDeploymentLabel, Address>>;
19
+ actors: Partial<Record<ActorLabel | "Admin", Address>>;
20
+ moduleIds: Partial<Record<ModuleIdLabel, bigint>>;
21
+ expressions: Partial<Record<ExpressionLabel, bigint>>;
22
+ }
23
+ export interface CreateScuroClientOptions {
24
+ publicClient: PublicClient;
25
+ walletClient?: WalletClient;
26
+ deployment: Partial<Record<DeploymentOutputLabel, string>> | DeploymentProfile | NormalizedDeployment;
27
+ chainId?: number;
28
+ }
29
+ export type EnumName = "GameCatalog.GameMode" | "GameCatalog.ModuleStatus" | "BaccaratTypes.BaccaratSide" | "BaccaratTypes.BaccaratOutcome" | "SingleDeckBlackjackEngine.SessionPhase" | "SingleDeckBlackjackEngine.Action" | "SingleDeckBlackjackEngine.ActionMask" | "SingleDraw2To7Engine.MatchState" | "SingleDraw2To7Engine.HandPhase";
30
+ export type GameModeLabel = "Solo" | "PvP" | "Tournament";
31
+ export type ModuleStatusLabel = "LIVE" | "RETIRED" | "DISABLED";
32
+ export type BaccaratSideLabel = "Player" | "Banker" | "Tie";
33
+ export type BaccaratOutcomeLabel = "PlayerWin" | "BankerWin" | "Tie";
34
+ export type BlackjackSessionPhaseLabel = "Inactive" | "AwaitingInitialDeal" | "AwaitingPlayerAction" | "AwaitingCoordinator" | "Completed";
35
+ export type BlackjackActionLabel = "ACTION_HIT" | "ACTION_STAND" | "ACTION_DOUBLE" | "ACTION_SPLIT";
36
+ export type BlackjackActionMaskLabel = "ALLOW_HIT" | "ALLOW_STAND" | "ALLOW_DOUBLE" | "ALLOW_SPLIT";
37
+ export type PokerMatchStateLabel = "Inactive" | "Active" | "Completed";
38
+ export type PokerHandPhaseLabel = "None" | "AwaitingInitialDeal" | "PreDrawBetting" | "DrawDeclaration" | "DrawProofPending" | "PostDrawBetting" | "ShowdownProofPending" | "HandComplete";
39
+ export interface PreparedTransactionRequest {
40
+ to: Address;
41
+ data: Hex;
42
+ value?: bigint;
43
+ }
44
+ export interface ContractEventMetadata {
45
+ name: string;
46
+ signature: string;
47
+ anonymous: boolean;
48
+ }
49
+ export interface ContractMetadata {
50
+ name: ContractName;
51
+ category: string;
52
+ source: string;
53
+ artifact: string;
54
+ reference_doc: string;
55
+ abi_path: string;
56
+ functions: readonly string[];
57
+ events: readonly string[];
58
+ }
59
+ export interface ContractDescriptor {
60
+ address: Address;
61
+ abi: Abi;
62
+ publicClient: PublicClient;
63
+ walletClient: WalletClient | undefined;
64
+ }
65
+ export interface SlotMachinePresetConfigInput {
66
+ volatilityTier: number;
67
+ configHash: Hex;
68
+ reelCount: number;
69
+ rowCount: number;
70
+ waysMode: number;
71
+ minStake: bigint;
72
+ maxStake: bigint;
73
+ maxPayoutMultiplierBps: bigint;
74
+ symbolIds: readonly number[];
75
+ wildSymbolId: number;
76
+ scatterSymbolId: number;
77
+ bonusSymbolId: number;
78
+ jackpotSymbolId: number;
79
+ reelWeightOffsets: readonly number[];
80
+ reelSymbolIds: readonly number[];
81
+ reelSymbolWeights: readonly number[];
82
+ paytableSymbolIds: readonly number[];
83
+ paytableMatchCounts: readonly number[];
84
+ paytableMultiplierBps: readonly number[];
85
+ freeSpinTriggerCount: number;
86
+ freeSpinAwardCounts: readonly number[];
87
+ maxFreeSpins: number;
88
+ maxRetriggers: number;
89
+ freeSpinMultiplierBps: number;
90
+ pickTriggerCount: number;
91
+ maxPickReveals: number;
92
+ pickAwardMultiplierBps: readonly number[];
93
+ holdTriggerCount: number;
94
+ holdBoardSize: number;
95
+ initialRespins: number;
96
+ maxRespins: number;
97
+ holdValueMultiplierBps: readonly number[];
98
+ jackpotTierIds: readonly number[];
99
+ jackpotAwardMultiplierBps: readonly number[];
100
+ jackpotTierWeights: readonly number[];
101
+ maxTotalEvents: number;
102
+ }
103
+ export interface SlotMachinePresetSummary {
104
+ active: boolean;
105
+ volatilityTier: number;
106
+ configHash: Hex;
107
+ reelCount: number;
108
+ rowCount: number;
109
+ waysMode: number;
110
+ minStake: bigint;
111
+ maxStake: bigint;
112
+ maxPayoutMultiplierBps: bigint;
113
+ maxFreeSpins: number;
114
+ maxRetriggers: number;
115
+ maxPickReveals: number;
116
+ maxRespins: number;
117
+ maxTotalEvents: number;
118
+ }
119
+ export interface SlotMachineSpinInspection {
120
+ spin: any;
121
+ spinResult: any;
122
+ settlementOutcome: any;
123
+ settled: boolean;
124
+ expressionTokenId: bigint;
125
+ presetSummary: SlotMachinePresetSummary;
126
+ }
127
+ export interface SuperBaccaratRoundInspection {
128
+ playerCards: readonly [number, number, number];
129
+ bankerCards: readonly [number, number, number];
130
+ playerCardCount: number;
131
+ bankerCardCount: number;
132
+ playerTotal: number;
133
+ bankerTotal: number;
134
+ natural: boolean;
135
+ outcome: number;
136
+ outcomeLabel: BaccaratOutcomeLabel;
137
+ randomWord: bigint;
138
+ fulfilled: boolean;
139
+ }
140
+ export interface SuperBaccaratSessionInspection {
141
+ round: SuperBaccaratRoundInspection;
142
+ settlementOutcome: any;
143
+ sessionSettled: boolean;
144
+ expressionTokenId: bigint;
145
+ }
146
+ export interface CheminDeFerTableInspection {
147
+ table: any;
148
+ takers: Address[];
149
+ takerAmounts: Record<Address, bigint>;
150
+ round: any;
151
+ resolved: boolean;
152
+ playerTakeCap: bigint;
153
+ matchedBankerRisk: bigint;
154
+ }
155
+ export interface GameEngineMetadataInput {
156
+ engineType: Hex;
157
+ verifier: Address;
158
+ configHash: Hex;
159
+ developerRewardBps: number;
160
+ active: boolean;
161
+ supportsTournament: boolean;
162
+ supportsPvP: boolean;
163
+ supportsSolo: boolean;
164
+ }
165
+ export interface ScuroContractHelpers {
166
+ publicClient: PublicClient;
167
+ walletClient: WalletClient | undefined;
168
+ deployment: NormalizedDeployment;
169
+ instances: any;
170
+ read: any;
171
+ encode: any;
172
+ write: any;
173
+ inspect: any;
174
+ helpers: any;
175
+ }
176
+ export interface ScuroFlowHelpers {
177
+ [key: string]: any;
178
+ }
179
+ export interface ScuroCoordinatorHelpers {
180
+ [key: string]: any;
181
+ }
182
+ export interface ScuroClient {
183
+ deployment: NormalizedDeployment;
184
+ contracts: ScuroContractHelpers;
185
+ flows: ScuroFlowHelpers;
186
+ coordinator: ScuroCoordinatorHelpers;
187
+ events: {
188
+ decode: (...args: any[]) => any;
189
+ };
190
+ registry: Record<string, any>;
191
+ manifest: Record<string, any>;
192
+ }
@@ -0,0 +1,9 @@
1
+ import { type Address, type Hex, type WalletClient } from "viem";
2
+ export declare function asAddress(value: string): Address;
3
+ export declare function asBigInt(value: string | number | bigint): bigint;
4
+ export declare function requireValue<T>(value: T | undefined, label: string): T;
5
+ export declare function optionalAddress(value: string | undefined): Address | undefined;
6
+ export declare function optionalBigInt(value: string | undefined): bigint | undefined;
7
+ export declare function ensureWalletClient(walletClient: WalletClient | undefined): WalletClient;
8
+ export declare function nowSeconds(value?: number | bigint): bigint;
9
+ export declare function toHex32(value: string): Hex;