@dubsdotapp/expo 0.5.2 → 0.5.4
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/index.d.mts +18 -2
- package/dist/index.d.ts +18 -2
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +12 -1
- package/src/hooks/useEnterArcadePool.ts +3 -1
- package/src/index.ts +1 -0
- package/src/types.ts +15 -1
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -41,6 +41,7 @@ import type {
|
|
|
41
41
|
ArcadeEntry,
|
|
42
42
|
ArcadeLeaderboardEntry,
|
|
43
43
|
ArcadePoolStats,
|
|
44
|
+
ArcadePoolResult,
|
|
44
45
|
StartAttemptResult,
|
|
45
46
|
SubmitScoreResult,
|
|
46
47
|
BuildArcadeEntryResult,
|
|
@@ -512,10 +513,12 @@ export class DubsClient {
|
|
|
512
513
|
poolId: res.poolId,
|
|
513
514
|
amount: res.amount,
|
|
514
515
|
destination: res.destination,
|
|
516
|
+
gameId: res.gameId,
|
|
517
|
+
gameAddress: res.gameAddress,
|
|
515
518
|
};
|
|
516
519
|
}
|
|
517
520
|
|
|
518
|
-
async enterArcadePool(poolId: number, params: { walletAddress: string; txSignature: string }): Promise<ArcadeEntry> {
|
|
521
|
+
async enterArcadePool(poolId: number, params: { walletAddress: string; txSignature: string; gameId?: string; gameAddress?: string }): Promise<ArcadeEntry> {
|
|
519
522
|
const res = await this.request<{ success: true; entry: ArcadeEntry }>(
|
|
520
523
|
'POST',
|
|
521
524
|
`/arcade/pools/${poolId}/enter`,
|
|
@@ -554,6 +557,14 @@ export class DubsClient {
|
|
|
554
557
|
return res.leaderboard;
|
|
555
558
|
}
|
|
556
559
|
|
|
560
|
+
async getArcadeResults(poolId: number): Promise<ArcadePoolResult[]> {
|
|
561
|
+
const res = await this.request<{ success: true; results: ArcadePoolResult[] }>(
|
|
562
|
+
'GET',
|
|
563
|
+
`/arcade/pools/${poolId}/results`,
|
|
564
|
+
);
|
|
565
|
+
return res.results;
|
|
566
|
+
}
|
|
567
|
+
|
|
557
568
|
async getArcadeEntry(poolId: number, walletAddress: string): Promise<ArcadeEntry> {
|
|
558
569
|
const res = await this.request<{ success: true; entry: ArcadeEntry }>(
|
|
559
570
|
'GET',
|
|
@@ -47,12 +47,14 @@ export function useEnterArcadePool() {
|
|
|
47
47
|
);
|
|
48
48
|
console.log('[useEnterArcadePool] Step 2 done. Signature:', signature);
|
|
49
49
|
|
|
50
|
-
// 3. Confirm entry with backend
|
|
50
|
+
// 3. Confirm entry with backend (pass gameId/gameAddress for on-chain tracking)
|
|
51
51
|
setStatus('confirming');
|
|
52
52
|
console.log('[useEnterArcadePool] Step 3: Confirming with backend...');
|
|
53
53
|
const entry = await client.enterArcadePool(poolId, {
|
|
54
54
|
walletAddress,
|
|
55
55
|
txSignature: signature,
|
|
56
|
+
gameId: buildResult.gameId,
|
|
57
|
+
gameAddress: buildResult.gameAddress,
|
|
56
58
|
});
|
|
57
59
|
console.log('[useEnterArcadePool] Step 3 done. Entry recorded.');
|
|
58
60
|
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -487,7 +487,9 @@ export interface BuildArcadeEntryResult {
|
|
|
487
487
|
transaction: string; // base64-encoded unsigned transaction
|
|
488
488
|
poolId: string;
|
|
489
489
|
amount: string;
|
|
490
|
-
destination
|
|
490
|
+
destination?: string;
|
|
491
|
+
gameId?: string; // on-chain game ID (set on first entry)
|
|
492
|
+
gameAddress?: string; // game PDA address
|
|
491
493
|
}
|
|
492
494
|
|
|
493
495
|
export interface EnterArcadePoolResult {
|
|
@@ -567,6 +569,18 @@ export interface SubmitScoreResult {
|
|
|
567
569
|
isNewBest: boolean;
|
|
568
570
|
}
|
|
569
571
|
|
|
572
|
+
export interface ArcadePoolResult {
|
|
573
|
+
id: number;
|
|
574
|
+
pool_id: number;
|
|
575
|
+
entry_id: number;
|
|
576
|
+
wallet_address: string;
|
|
577
|
+
amount_lamports: string;
|
|
578
|
+
status: string;
|
|
579
|
+
username: string;
|
|
580
|
+
avatar: string | null;
|
|
581
|
+
best_score: number;
|
|
582
|
+
}
|
|
583
|
+
|
|
570
584
|
// ── UI Config (developer branding) ──
|
|
571
585
|
|
|
572
586
|
export interface UiConfig {
|