@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.
- package/LICENSE +21 -0
- package/README.md +294 -0
- package/dist/client.d.ts +2 -0
- package/dist/contracts.d.ts +47 -0
- package/dist/contracts.js +22451 -0
- package/dist/coordinator.d.ts +108 -0
- package/dist/coordinator.js +22586 -0
- package/dist/flows.d.ts +2 -0
- package/dist/flows.js +22625 -0
- package/dist/generated/abis.d.ts +12879 -0
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated/protocol.d.ts +13856 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +22863 -0
- package/dist/internal/enums.d.ts +11 -0
- package/dist/internal/errors.d.ts +23 -0
- package/dist/internal/types.d.ts +192 -0
- package/dist/internal/utils.d.ts +9 -0
- package/dist/manifest.d.ts +863 -0
- package/dist/manifest.js +18333 -0
- package/dist/registry.d.ts +12 -0
- package/dist/registry.js +21306 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.js +18416 -0
- package/package.json +88 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
2
|
+
import { createContractHelpers } from "./contracts";
|
|
3
|
+
import type { CreateScuroClientOptions, ScuroContractHelpers, ScuroCoordinatorHelpers } from "./internal/types";
|
|
4
|
+
export interface PokerInitialDealProof {
|
|
5
|
+
deckCommitment: Hex;
|
|
6
|
+
handNonce: Hex;
|
|
7
|
+
handCommitments: readonly [Hex, Hex];
|
|
8
|
+
encryptionKeyCommitments: readonly [Hex, Hex];
|
|
9
|
+
ciphertextRefs: readonly [Hex, Hex];
|
|
10
|
+
proof: Hex;
|
|
11
|
+
}
|
|
12
|
+
export interface PokerDrawProof {
|
|
13
|
+
player: Address;
|
|
14
|
+
newCommitment: Hex;
|
|
15
|
+
newEncryptionKeyCommitment: Hex;
|
|
16
|
+
newCiphertextRef: Hex;
|
|
17
|
+
proof: Hex;
|
|
18
|
+
}
|
|
19
|
+
export interface PokerShowdownProof {
|
|
20
|
+
winnerAddr: Address;
|
|
21
|
+
isTie: boolean;
|
|
22
|
+
proof: Hex;
|
|
23
|
+
}
|
|
24
|
+
export interface PokerProofProvider {
|
|
25
|
+
provideInitialDeal(snapshot: Awaited<ReturnType<ReturnType<typeof createContractHelpers>["inspect"]["pokerGame"]>>): Promise<PokerInitialDealProof>;
|
|
26
|
+
provideDraw(snapshot: Awaited<ReturnType<ReturnType<typeof createContractHelpers>["inspect"]["pokerGame"]>> & {
|
|
27
|
+
player: Address;
|
|
28
|
+
playerIndex: 0 | 1;
|
|
29
|
+
}): Promise<PokerDrawProof>;
|
|
30
|
+
provideShowdown(snapshot: Awaited<ReturnType<ReturnType<typeof createContractHelpers>["inspect"]["pokerGame"]>>): Promise<PokerShowdownProof>;
|
|
31
|
+
}
|
|
32
|
+
export interface BlackjackInitialDealProof {
|
|
33
|
+
deckCommitment: Hex;
|
|
34
|
+
handNonce: Hex;
|
|
35
|
+
playerStateCommitment: Hex;
|
|
36
|
+
dealerStateCommitment: Hex;
|
|
37
|
+
playerCiphertextRef: Hex;
|
|
38
|
+
dealerCiphertextRef: Hex;
|
|
39
|
+
dealerVisibleValue: bigint;
|
|
40
|
+
handCount: number;
|
|
41
|
+
activeHandIndex: number;
|
|
42
|
+
payout: bigint;
|
|
43
|
+
immediateResultCode: number;
|
|
44
|
+
handValues: readonly [bigint, bigint, bigint, bigint];
|
|
45
|
+
handStatuses: readonly [number, number, number, number];
|
|
46
|
+
allowedActionMasks: readonly [number, number, number, number];
|
|
47
|
+
softMask: bigint;
|
|
48
|
+
proof: Hex;
|
|
49
|
+
}
|
|
50
|
+
export interface BlackjackActionProof {
|
|
51
|
+
kind: "action";
|
|
52
|
+
args: {
|
|
53
|
+
newPlayerStateCommitment: Hex;
|
|
54
|
+
dealerStateCommitment: Hex;
|
|
55
|
+
playerCiphertextRef: Hex;
|
|
56
|
+
dealerCiphertextRef: Hex;
|
|
57
|
+
dealerVisibleValue: bigint;
|
|
58
|
+
handCount: number;
|
|
59
|
+
activeHandIndex: number;
|
|
60
|
+
nextPhase: number;
|
|
61
|
+
handValues: readonly [bigint, bigint, bigint, bigint];
|
|
62
|
+
handStatuses: readonly [number, number, number, number];
|
|
63
|
+
allowedActionMasks: readonly [number, number, number, number];
|
|
64
|
+
softMask: bigint;
|
|
65
|
+
proof: Hex;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export interface BlackjackShowdownProof {
|
|
69
|
+
kind: "showdown";
|
|
70
|
+
args: {
|
|
71
|
+
playerStateCommitment: Hex;
|
|
72
|
+
dealerStateCommitment: Hex;
|
|
73
|
+
payout: bigint;
|
|
74
|
+
dealerFinalValue: bigint;
|
|
75
|
+
handCount: number;
|
|
76
|
+
activeHandIndex: number;
|
|
77
|
+
handStatuses: readonly [number, number, number, number];
|
|
78
|
+
proof: Hex;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export interface BlackjackProofProvider {
|
|
82
|
+
provideInitialDeal(snapshot: Awaited<ReturnType<ReturnType<typeof createContractHelpers>["inspect"]["blackjackSession"]>>): Promise<BlackjackInitialDealProof>;
|
|
83
|
+
provideNext(snapshot: Awaited<ReturnType<ReturnType<typeof createContractHelpers>["inspect"]["blackjackSession"]>>): Promise<BlackjackActionProof | BlackjackShowdownProof>;
|
|
84
|
+
}
|
|
85
|
+
export interface CoordinatorStepResult {
|
|
86
|
+
status: "submitted" | "idle";
|
|
87
|
+
action: string;
|
|
88
|
+
txHash?: Hex;
|
|
89
|
+
}
|
|
90
|
+
export declare function createPokerCoordinator(args: {
|
|
91
|
+
contracts: ScuroContractHelpers;
|
|
92
|
+
mode: "pvp" | "tournament";
|
|
93
|
+
proofProvider: PokerProofProvider;
|
|
94
|
+
resolvePlayers?: (gameId: bigint) => Promise<readonly [Address, Address]>;
|
|
95
|
+
}): {
|
|
96
|
+
snapshot: (gameId: bigint) => Promise<any>;
|
|
97
|
+
step: (gameId: bigint) => Promise<CoordinatorStepResult>;
|
|
98
|
+
runUntilIdle: (gameId: bigint, maxSteps?: number) => Promise<CoordinatorStepResult[]>;
|
|
99
|
+
};
|
|
100
|
+
export declare function createBlackjackCoordinator(args: {
|
|
101
|
+
contracts: ScuroContractHelpers;
|
|
102
|
+
proofProvider: BlackjackProofProvider;
|
|
103
|
+
}): {
|
|
104
|
+
snapshot: (sessionId: bigint) => Promise<any>;
|
|
105
|
+
step: (sessionId: bigint) => Promise<CoordinatorStepResult>;
|
|
106
|
+
runUntilIdle: (sessionId: bigint, maxSteps?: number) => Promise<CoordinatorStepResult[]>;
|
|
107
|
+
};
|
|
108
|
+
export declare function createCoordinatorHelpers(options: CreateScuroClientOptions): ScuroCoordinatorHelpers;
|