@playmos/sdk 0.3.11 → 0.3.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 +8 -0
- package/README.md +3 -2
- package/dist/{chunk-35WJANW4.js → chunk-2CW4U5YB.js} +192 -2
- package/dist/{errors-Dpeesyop.d.cts → errors-CYKgt2VU.d.cts} +64 -8
- package/dist/{errors-Dpeesyop.d.ts → errors-CYKgt2VU.d.ts} +64 -8
- package/dist/index.cjs +1275 -8
- package/dist/index.d.cts +662 -16
- package/dist/index.d.ts +662 -16
- package/dist/index.js +1072 -12
- package/dist/server.d.cts +3 -11
- package/dist/server.d.ts +3 -11
- package/dist/server.js +2 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@ All notable changes to `@playmos/sdk`. This project adheres to [Semantic Version
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## [0.3.12] — 2026-08-27
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- **Operator-signed epoch settlement (E1b / sdk#664 / PR #670):** `epochs.getAttestation`, `epochs.executeSettlement`, `epochs.settlementTypedData`. Service `POST`/`GET` `/v1/epochs/:epochId/attestation`. GET is a public board (any authenticated key). POST is `sk_` + studio-gated. Amounts stay micro-USDC strings. Refs #664.
|
|
11
|
+
|
|
12
|
+
### Notes
|
|
13
|
+
- Hub CI installs from npm, not the monorepo. This tag is what E1c (hub auto-pin before broadcast) consumes.
|
|
14
|
+
|
|
7
15
|
## [0.3.11] — 2026-08-09
|
|
8
16
|
|
|
9
17
|
### Added
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**🧪 Beta — Playmos SDK.** Runs on Base Sepolia **testnet**. The value-movement primitives (escrow / marketplace / transfer) are proven on-chain but **not yet production-hardened**, and nothing is on mainnet. Build and integrate freely against the sandbox; don't route real user funds yet.
|
|
4
4
|
|
|
5
|
-
Stablecoin payments for games on Base. One SDK for in-app purchases (1%),
|
|
5
|
+
Stablecoin payments for games on Base. One SDK for in-app purchases (**1%** Playmos — you keep 99%), **first-party** skill contests (**60/30/10**), and **in-game economies** (player · NPC · agent commerce via `transfer()`). Independent studio contests: Playmos take is **1%** and **cannot be changed**; default studio-side split is **60/30/9** — **not live yet**. Live sandbox skill entry still uses the first-party 60/30/10 shape. USD in, USDC on-chain — no crypto UX for your players.
|
|
6
6
|
|
|
7
7
|
**Changelog:** see [`CHANGELOG.md`](./CHANGELOG.md) (shipped in the npm tarball from the next publish). **Breaking in 0.3.8:** player-wallet `enterRound` requires `identity` — no silent invent.
|
|
8
8
|
|
|
@@ -77,7 +77,8 @@ const entry = await playmos.enterRound({
|
|
|
77
77
|
amount: "1.00", // grows this round's pool
|
|
78
78
|
playerId: "player_abc",
|
|
79
79
|
});
|
|
80
|
-
// entry.status === "confirmed"; entry.split is
|
|
80
|
+
// entry.status === "confirmed"; entry.split is a first-party 60/30/10 *projection*
|
|
81
|
+
// (sandbox / Playmos Lab — not a studio 60/30/9+1% split, not a chain read)
|
|
81
82
|
```
|
|
82
83
|
|
|
83
84
|
### Move USDC between wallets — `transfer()`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { numberToHex,
|
|
1
|
+
import { keccak256, toHex, numberToHex, encodeFunctionData, toBytes, getAddress } from 'viem';
|
|
2
2
|
|
|
3
3
|
// src/errors.ts
|
|
4
4
|
var PlaymosError = class extends Error {
|
|
@@ -81,6 +81,12 @@ var NothingToWithdrawError = class extends PlaymosError {
|
|
|
81
81
|
);
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
+
function seriesToBytes32(series) {
|
|
85
|
+
const s = series.trim();
|
|
86
|
+
if (/^0x[0-9a-fA-F]{64}$/.test(s)) return s.toLowerCase();
|
|
87
|
+
return keccak256(toHex(s));
|
|
88
|
+
}
|
|
89
|
+
var identityToBytes32 = seriesToBytes32;
|
|
84
90
|
|
|
85
91
|
// src/chain/abis.ts
|
|
86
92
|
var erc20Abi = [
|
|
@@ -219,6 +225,174 @@ async function assertEnoughGas(provider, from, minWei) {
|
|
|
219
225
|
}
|
|
220
226
|
}
|
|
221
227
|
|
|
228
|
+
// src/chain/epochPrizePoolAbi.ts
|
|
229
|
+
var epochPrizePoolViewAbi = [
|
|
230
|
+
{
|
|
231
|
+
type: "function",
|
|
232
|
+
name: "currentEpochId",
|
|
233
|
+
stateMutability: "view",
|
|
234
|
+
inputs: [{ name: "series", type: "bytes32" }],
|
|
235
|
+
outputs: [{ type: "uint256" }]
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
type: "function",
|
|
239
|
+
name: "epochIdAt",
|
|
240
|
+
stateMutability: "view",
|
|
241
|
+
inputs: [
|
|
242
|
+
{ name: "series", type: "bytes32" },
|
|
243
|
+
{ name: "timestamp", type: "uint256" }
|
|
244
|
+
],
|
|
245
|
+
outputs: [{ type: "uint256" }]
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
type: "function",
|
|
249
|
+
name: "epochPool",
|
|
250
|
+
stateMutability: "view",
|
|
251
|
+
inputs: [
|
|
252
|
+
{ name: "series", type: "bytes32" },
|
|
253
|
+
{ name: "epochId", type: "uint256" }
|
|
254
|
+
],
|
|
255
|
+
outputs: [{ type: "uint256" }]
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
type: "function",
|
|
259
|
+
name: "epochOutgoingSeed",
|
|
260
|
+
stateMutability: "view",
|
|
261
|
+
inputs: [
|
|
262
|
+
{ name: "series", type: "bytes32" },
|
|
263
|
+
{ name: "epochId", type: "uint256" }
|
|
264
|
+
],
|
|
265
|
+
outputs: [{ type: "uint256" }]
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
type: "function",
|
|
269
|
+
name: "epochIncomingSeed",
|
|
270
|
+
stateMutability: "view",
|
|
271
|
+
inputs: [
|
|
272
|
+
{ name: "series", type: "bytes32" },
|
|
273
|
+
{ name: "epochId", type: "uint256" }
|
|
274
|
+
],
|
|
275
|
+
outputs: [{ type: "uint256" }]
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
type: "function",
|
|
279
|
+
name: "epochEntryCount",
|
|
280
|
+
stateMutability: "view",
|
|
281
|
+
inputs: [
|
|
282
|
+
{ name: "series", type: "bytes32" },
|
|
283
|
+
{ name: "epochId", type: "uint256" }
|
|
284
|
+
],
|
|
285
|
+
outputs: [{ type: "uint256" }]
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
type: "function",
|
|
289
|
+
name: "getSeries",
|
|
290
|
+
stateMutability: "view",
|
|
291
|
+
inputs: [{ name: "series", type: "bytes32" }],
|
|
292
|
+
outputs: [
|
|
293
|
+
{ name: "created", type: "bool" },
|
|
294
|
+
{ name: "genesis", type: "uint256" },
|
|
295
|
+
{ name: "epochDuration", type: "uint256" },
|
|
296
|
+
{ name: "entry", type: "uint256" },
|
|
297
|
+
{ name: "feeBps", type: "uint16" },
|
|
298
|
+
{ name: "poolBps", type: "uint16" },
|
|
299
|
+
{ name: "seedBps", type: "uint16" }
|
|
300
|
+
]
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
type: "function",
|
|
304
|
+
name: "getEpoch",
|
|
305
|
+
stateMutability: "view",
|
|
306
|
+
inputs: [
|
|
307
|
+
{ name: "series", type: "bytes32" },
|
|
308
|
+
{ name: "epochId", type: "uint256" }
|
|
309
|
+
],
|
|
310
|
+
outputs: [
|
|
311
|
+
{ name: "pool", type: "uint256" },
|
|
312
|
+
{ name: "outgoingSeed", type: "uint256" },
|
|
313
|
+
{ name: "incomingSeed", type: "uint256" },
|
|
314
|
+
{ name: "entryCount_", type: "uint256" },
|
|
315
|
+
{ name: "terminal", type: "uint8" }
|
|
316
|
+
]
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
type: "function",
|
|
320
|
+
name: "entryCount",
|
|
321
|
+
stateMutability: "view",
|
|
322
|
+
inputs: [
|
|
323
|
+
{ name: "series", type: "bytes32" },
|
|
324
|
+
{ name: "epochId", type: "uint256" },
|
|
325
|
+
{ name: "identity", type: "bytes32" }
|
|
326
|
+
],
|
|
327
|
+
outputs: [{ type: "uint256" }]
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
type: "function",
|
|
331
|
+
name: "claimableRefund",
|
|
332
|
+
stateMutability: "view",
|
|
333
|
+
inputs: [
|
|
334
|
+
{ name: "series", type: "bytes32" },
|
|
335
|
+
{ name: "epochId", type: "uint256" },
|
|
336
|
+
{ name: "payer", type: "address" }
|
|
337
|
+
],
|
|
338
|
+
outputs: [{ type: "uint256" }]
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
type: "function",
|
|
342
|
+
name: "withdrawable",
|
|
343
|
+
stateMutability: "view",
|
|
344
|
+
inputs: [{ name: "account", type: "address" }],
|
|
345
|
+
outputs: [{ type: "uint256" }]
|
|
346
|
+
}
|
|
347
|
+
];
|
|
348
|
+
var epochPrizePoolEnterAbi = [
|
|
349
|
+
{
|
|
350
|
+
type: "function",
|
|
351
|
+
name: "enter",
|
|
352
|
+
stateMutability: "nonpayable",
|
|
353
|
+
inputs: [
|
|
354
|
+
{ name: "series", type: "bytes32" },
|
|
355
|
+
{ name: "identity", type: "bytes32" }
|
|
356
|
+
],
|
|
357
|
+
outputs: []
|
|
358
|
+
}
|
|
359
|
+
];
|
|
360
|
+
var epochPrizePoolRefundAbi = [
|
|
361
|
+
{
|
|
362
|
+
type: "function",
|
|
363
|
+
name: "claimRefund",
|
|
364
|
+
stateMutability: "nonpayable",
|
|
365
|
+
inputs: [
|
|
366
|
+
{ name: "series", type: "bytes32" },
|
|
367
|
+
{ name: "epochId", type: "uint256" },
|
|
368
|
+
{ name: "payer", type: "address" }
|
|
369
|
+
],
|
|
370
|
+
outputs: [{ name: "amount", type: "uint256" }]
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
type: "function",
|
|
374
|
+
name: "withdraw",
|
|
375
|
+
stateMutability: "nonpayable",
|
|
376
|
+
inputs: [],
|
|
377
|
+
outputs: []
|
|
378
|
+
}
|
|
379
|
+
];
|
|
380
|
+
var epochPrizePoolExecuteSettlementAbi = [
|
|
381
|
+
{
|
|
382
|
+
type: "function",
|
|
383
|
+
name: "executeSignedSettlement",
|
|
384
|
+
stateMutability: "nonpayable",
|
|
385
|
+
inputs: [
|
|
386
|
+
{ name: "series", type: "bytes32" },
|
|
387
|
+
{ name: "epochId", type: "uint256" },
|
|
388
|
+
{ name: "winners", type: "address[]" },
|
|
389
|
+
{ name: "amounts", type: "uint256[]" },
|
|
390
|
+
{ name: "signature", type: "bytes" }
|
|
391
|
+
],
|
|
392
|
+
outputs: []
|
|
393
|
+
}
|
|
394
|
+
];
|
|
395
|
+
|
|
222
396
|
// src/chain/calls.ts
|
|
223
397
|
var toBytes32 = (s) => keccak256(toBytes(s));
|
|
224
398
|
function buildIapCalls(args) {
|
|
@@ -251,5 +425,21 @@ function buildWithdrawCall(prizePool) {
|
|
|
251
425
|
});
|
|
252
426
|
return { to: prizePool, data };
|
|
253
427
|
}
|
|
428
|
+
function buildEpochExecuteSettlementCall(args) {
|
|
429
|
+
return {
|
|
430
|
+
to: args.epochPrizePool,
|
|
431
|
+
data: encodeFunctionData({
|
|
432
|
+
abi: epochPrizePoolExecuteSettlementAbi,
|
|
433
|
+
functionName: "executeSignedSettlement",
|
|
434
|
+
args: [
|
|
435
|
+
seriesToBytes32(args.series),
|
|
436
|
+
args.epochId,
|
|
437
|
+
args.winners.map((w) => getAddress(w.toLowerCase())),
|
|
438
|
+
args.amounts,
|
|
439
|
+
args.signature
|
|
440
|
+
]
|
|
441
|
+
})
|
|
442
|
+
};
|
|
443
|
+
}
|
|
254
444
|
|
|
255
|
-
export { AlreadyEnteredError, ApiError, AuthError, ConfigError, InsufficientGasError, InvalidAmountError, MissingFieldError, NothingToWithdrawError, PaymentFailedError, PlaymosError, WalletConnectionError, WalletTimeoutError, assertEnoughGas, buildEntryCalls, buildIapCalls, buildWithdrawCall, prizePoolAbi, sendCalls, toBytes32, waitForCalls };
|
|
445
|
+
export { AlreadyEnteredError, ApiError, AuthError, ConfigError, InsufficientGasError, InvalidAmountError, MissingFieldError, NothingToWithdrawError, PaymentFailedError, PlaymosError, WalletConnectionError, WalletTimeoutError, assertEnoughGas, buildEntryCalls, buildEpochExecuteSettlementCall, buildIapCalls, buildWithdrawCall, encodeApprove, epochPrizePoolEnterAbi, epochPrizePoolRefundAbi, epochPrizePoolViewAbi, identityToBytes32, prizePoolAbi, sendCalls, seriesToBytes32, toBytes32, waitForCalls };
|
|
@@ -46,6 +46,8 @@ interface ContractConfig {
|
|
|
46
46
|
usdc?: `0x${string}`;
|
|
47
47
|
playmosPay?: `0x${string}`;
|
|
48
48
|
prizePool?: `0x${string}`;
|
|
49
|
+
/** EpochPrizePool (rolling-epoch reads — sdk#629). Live PrizePool stays on prizePool. */
|
|
50
|
+
epochPrizePool?: `0x${string}`;
|
|
49
51
|
}
|
|
50
52
|
/**
|
|
51
53
|
* @deprecated Unused — agent routes are enabled server-side (SERVICE_MASTER_SECRET +
|
|
@@ -404,7 +406,7 @@ interface Payment {
|
|
|
404
406
|
/** `pay_…` (IAP) or `entry_…` (prize-pool) — ULID, server-issued, unique. */
|
|
405
407
|
id: string;
|
|
406
408
|
status: PaymentStatus;
|
|
407
|
-
/** "iap" (1% external) or "entry" (60/30/10
|
|
409
|
+
/** "iap" (1% external) or "entry" (prize-pool; `split` is a first-party 60/30/10 projection). */
|
|
408
410
|
kind: "iap" | "entry";
|
|
409
411
|
/**
|
|
410
412
|
* Requested amount (USD string). For prize-pool **server-settle**, this may
|
|
@@ -423,12 +425,13 @@ interface Payment {
|
|
|
423
425
|
chainAmountMicro?: string;
|
|
424
426
|
/**
|
|
425
427
|
* First-party **60/30/10 projection** (pool/seed/rake USD strings) for prize-pool
|
|
426
|
-
* entries — bookkeeping preview, **not** a
|
|
427
|
-
* (sdk#514). Numbers come from SDK constants
|
|
428
|
-
* not from reading the deployed pool’s
|
|
429
|
-
* takes the fee off the top; pool/seed
|
|
430
|
-
*
|
|
431
|
-
*
|
|
428
|
+
* entries — bookkeeping preview, **not** a studio 60/30/9+1% split and **not** a
|
|
429
|
+
* chain-derived settlement observation (sdk#514). Numbers come from SDK constants
|
|
430
|
+
* (`POOL_BPS`/`SEED_BPS`/`RAKE_BPS`), not from reading the deployed pool’s
|
|
431
|
+
* constructor bps. On-chain, entry only takes the fee off the top; pool/seed
|
|
432
|
+
* split at **lock**; payable pot also includes inherited seedBank — so
|
|
433
|
+
* `split.pool` is **not** “what this round pays.” Reconcile money with
|
|
434
|
+
* {@link Payment.chainAmount} / pool `getRound`.
|
|
432
435
|
* Field name kept for compatibility (no rename in V1).
|
|
433
436
|
*/
|
|
434
437
|
split?: {
|
|
@@ -637,6 +640,22 @@ interface CancelRoundResult {
|
|
|
637
640
|
status: "cancelling" | "cancelled";
|
|
638
641
|
round?: RoundState;
|
|
639
642
|
}
|
|
643
|
+
/** L34 / sdk#610 — a win is funded only after the push tx, else claimable. */
|
|
644
|
+
type PayoutNoticeStatus = "funded" | "claimable";
|
|
645
|
+
interface PayoutNotice {
|
|
646
|
+
roundId: string;
|
|
647
|
+
wallet: `0x${string}`;
|
|
648
|
+
amountMicro: string;
|
|
649
|
+
status: PayoutNoticeStatus;
|
|
650
|
+
/** Present only when status === "funded". */
|
|
651
|
+
txHash?: `0x${string}`;
|
|
652
|
+
reason?: string;
|
|
653
|
+
}
|
|
654
|
+
interface PayoutNoticesResult {
|
|
655
|
+
roundId?: string;
|
|
656
|
+
status?: string;
|
|
657
|
+
notices: PayoutNotice[];
|
|
658
|
+
}
|
|
640
659
|
/** What `rounds.prize({ … })` returns — claimable pull-payment balance (issue #41). */
|
|
641
660
|
interface PrizeBalance {
|
|
642
661
|
roundId: string;
|
|
@@ -707,6 +726,43 @@ interface SettleRoundResult {
|
|
|
707
726
|
status: "settled" | "settling";
|
|
708
727
|
}
|
|
709
728
|
|
|
729
|
+
/**
|
|
730
|
+
* EIP-5792 batch primitives — ported from the proven game-hub `payEntryOnchain`
|
|
731
|
+
* path (`OnchainEntry.ts`). One `wallet_sendCalls` sends `approve` + the settling
|
|
732
|
+
* call as ONE atomic confirmation; the paymaster sponsors gas when configured.
|
|
733
|
+
* The player sees a single Apple-Pay-style sheet.
|
|
734
|
+
*/
|
|
735
|
+
|
|
736
|
+
interface Call {
|
|
737
|
+
to: `0x${string}`;
|
|
738
|
+
data: `0x${string}`;
|
|
739
|
+
}
|
|
740
|
+
type OnchainStatus = "PENDING" | "CONFIRMED" | "FAILED";
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* Calldata builders. IAP / PrizePool entry stay on `toBytes32` (keccak of
|
|
744
|
+
* UTF-8 via toBytes) because live paid entries were written with it.
|
|
745
|
+
* Epoch execute uses `seriesToBytes32` — hex-shaped series must not drift.
|
|
746
|
+
*/
|
|
747
|
+
|
|
748
|
+
/** The server derives these identically (keccak256 of UTF-8 bytes) so the
|
|
749
|
+
* off-chain record and the on-chain call line up. */
|
|
750
|
+
declare const toBytes32: (s: string) => `0x${string}`;
|
|
751
|
+
interface EpochExecuteSettlementCallArgs {
|
|
752
|
+
epochPrizePool: `0x${string}`;
|
|
753
|
+
series: string;
|
|
754
|
+
epochId: bigint;
|
|
755
|
+
winners: `0x${string}`[];
|
|
756
|
+
amounts: bigint[];
|
|
757
|
+
signature: `0x${string}`;
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* EpochPrizePool.executeSignedSettlement — permissionless relay of an
|
|
761
|
+
* operator-signed podium (sdk#664 E1b). Series hashed with seriesToBytes32
|
|
762
|
+
* (not this file's toBytes32) so hex-shaped series cannot drift from the chain.
|
|
763
|
+
*/
|
|
764
|
+
declare function buildEpochExecuteSettlementCall(args: EpochExecuteSettlementCallArgs): Call;
|
|
765
|
+
|
|
710
766
|
/**
|
|
711
767
|
* Typed, actionable errors — the Stripe bar (spec §11).
|
|
712
768
|
*
|
|
@@ -778,4 +834,4 @@ declare class NothingToWithdrawError extends PlaymosError {
|
|
|
778
834
|
constructor(detail?: Record<string, unknown>);
|
|
779
835
|
}
|
|
780
836
|
|
|
781
|
-
export { type
|
|
837
|
+
export { type PaymentStatus as $, type ActiveSeriesRound as A, AuthError as B, type Call as C, ConfigError as D, type EscrowHoldInput as E, type ContractConfig as F, type Eip1193Provider as G, type GasConfig as H, type GasMode as I, InsufficientGasError as J, InvalidAmountError as K, type Listing as L, type MarketplaceListInput as M, type Network as N, type OnchainStatus as O, type PlaymosConfig as P, type ListingStatus as Q, type RoundOpenInput as R, type SettleRoundResult as S, type TransferResult as T, type MarketplaceItem as U, type VerifyResult as V, type WebhookEvent as W, type MarketplaceSale as X, MissingFieldError as Y, NothingToWithdrawError as Z, PaymentFailedError as _, type RoundState as a, type PayoutNotice as a0, type PayoutNoticeStatus as a1, PlaymosError as a2, type PlaymosErrorCode as a3, type RetryOptions as a4, type RoundGetVia as a5, type RoundStatus as a6, type WalletConfig as a7, WalletConnectionError as a8, type WalletConnector as a9, WalletTimeoutError as aa, type WebhookEventType as ab, buildEpochExecuteSettlementCall as ac, toBytes32 as ad, type RoundSettleInput as b, type RoundCancelInput as c, type CancelRoundResult as d, type RoundGetResult as e, type PayoutNoticesResult as f, type PrizeBalance as g, type WithdrawResult as h, type AgentWallet as i, type AgentFundResult as j, type EscrowHoldResult as k, type EscrowResolveResult as l, type MarketplaceSaleResult as m, type MarketplaceGetResult as n, type PayInput as o, type Payment as p, type EnterRoundInput as q, type TransferReconcile as r, type WaitOptions as s, type TransferInput as t, type TransferConfirmOptions as u, type PayoutRule as v, type ActiveForSeriesResult as w, type AgentEconomyConfig as x, AlreadyEnteredError as y, ApiError as z };
|
|
@@ -46,6 +46,8 @@ interface ContractConfig {
|
|
|
46
46
|
usdc?: `0x${string}`;
|
|
47
47
|
playmosPay?: `0x${string}`;
|
|
48
48
|
prizePool?: `0x${string}`;
|
|
49
|
+
/** EpochPrizePool (rolling-epoch reads — sdk#629). Live PrizePool stays on prizePool. */
|
|
50
|
+
epochPrizePool?: `0x${string}`;
|
|
49
51
|
}
|
|
50
52
|
/**
|
|
51
53
|
* @deprecated Unused — agent routes are enabled server-side (SERVICE_MASTER_SECRET +
|
|
@@ -404,7 +406,7 @@ interface Payment {
|
|
|
404
406
|
/** `pay_…` (IAP) or `entry_…` (prize-pool) — ULID, server-issued, unique. */
|
|
405
407
|
id: string;
|
|
406
408
|
status: PaymentStatus;
|
|
407
|
-
/** "iap" (1% external) or "entry" (60/30/10
|
|
409
|
+
/** "iap" (1% external) or "entry" (prize-pool; `split` is a first-party 60/30/10 projection). */
|
|
408
410
|
kind: "iap" | "entry";
|
|
409
411
|
/**
|
|
410
412
|
* Requested amount (USD string). For prize-pool **server-settle**, this may
|
|
@@ -423,12 +425,13 @@ interface Payment {
|
|
|
423
425
|
chainAmountMicro?: string;
|
|
424
426
|
/**
|
|
425
427
|
* First-party **60/30/10 projection** (pool/seed/rake USD strings) for prize-pool
|
|
426
|
-
* entries — bookkeeping preview, **not** a
|
|
427
|
-
* (sdk#514). Numbers come from SDK constants
|
|
428
|
-
* not from reading the deployed pool’s
|
|
429
|
-
* takes the fee off the top; pool/seed
|
|
430
|
-
*
|
|
431
|
-
*
|
|
428
|
+
* entries — bookkeeping preview, **not** a studio 60/30/9+1% split and **not** a
|
|
429
|
+
* chain-derived settlement observation (sdk#514). Numbers come from SDK constants
|
|
430
|
+
* (`POOL_BPS`/`SEED_BPS`/`RAKE_BPS`), not from reading the deployed pool’s
|
|
431
|
+
* constructor bps. On-chain, entry only takes the fee off the top; pool/seed
|
|
432
|
+
* split at **lock**; payable pot also includes inherited seedBank — so
|
|
433
|
+
* `split.pool` is **not** “what this round pays.” Reconcile money with
|
|
434
|
+
* {@link Payment.chainAmount} / pool `getRound`.
|
|
432
435
|
* Field name kept for compatibility (no rename in V1).
|
|
433
436
|
*/
|
|
434
437
|
split?: {
|
|
@@ -637,6 +640,22 @@ interface CancelRoundResult {
|
|
|
637
640
|
status: "cancelling" | "cancelled";
|
|
638
641
|
round?: RoundState;
|
|
639
642
|
}
|
|
643
|
+
/** L34 / sdk#610 — a win is funded only after the push tx, else claimable. */
|
|
644
|
+
type PayoutNoticeStatus = "funded" | "claimable";
|
|
645
|
+
interface PayoutNotice {
|
|
646
|
+
roundId: string;
|
|
647
|
+
wallet: `0x${string}`;
|
|
648
|
+
amountMicro: string;
|
|
649
|
+
status: PayoutNoticeStatus;
|
|
650
|
+
/** Present only when status === "funded". */
|
|
651
|
+
txHash?: `0x${string}`;
|
|
652
|
+
reason?: string;
|
|
653
|
+
}
|
|
654
|
+
interface PayoutNoticesResult {
|
|
655
|
+
roundId?: string;
|
|
656
|
+
status?: string;
|
|
657
|
+
notices: PayoutNotice[];
|
|
658
|
+
}
|
|
640
659
|
/** What `rounds.prize({ … })` returns — claimable pull-payment balance (issue #41). */
|
|
641
660
|
interface PrizeBalance {
|
|
642
661
|
roundId: string;
|
|
@@ -707,6 +726,43 @@ interface SettleRoundResult {
|
|
|
707
726
|
status: "settled" | "settling";
|
|
708
727
|
}
|
|
709
728
|
|
|
729
|
+
/**
|
|
730
|
+
* EIP-5792 batch primitives — ported from the proven game-hub `payEntryOnchain`
|
|
731
|
+
* path (`OnchainEntry.ts`). One `wallet_sendCalls` sends `approve` + the settling
|
|
732
|
+
* call as ONE atomic confirmation; the paymaster sponsors gas when configured.
|
|
733
|
+
* The player sees a single Apple-Pay-style sheet.
|
|
734
|
+
*/
|
|
735
|
+
|
|
736
|
+
interface Call {
|
|
737
|
+
to: `0x${string}`;
|
|
738
|
+
data: `0x${string}`;
|
|
739
|
+
}
|
|
740
|
+
type OnchainStatus = "PENDING" | "CONFIRMED" | "FAILED";
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* Calldata builders. IAP / PrizePool entry stay on `toBytes32` (keccak of
|
|
744
|
+
* UTF-8 via toBytes) because live paid entries were written with it.
|
|
745
|
+
* Epoch execute uses `seriesToBytes32` — hex-shaped series must not drift.
|
|
746
|
+
*/
|
|
747
|
+
|
|
748
|
+
/** The server derives these identically (keccak256 of UTF-8 bytes) so the
|
|
749
|
+
* off-chain record and the on-chain call line up. */
|
|
750
|
+
declare const toBytes32: (s: string) => `0x${string}`;
|
|
751
|
+
interface EpochExecuteSettlementCallArgs {
|
|
752
|
+
epochPrizePool: `0x${string}`;
|
|
753
|
+
series: string;
|
|
754
|
+
epochId: bigint;
|
|
755
|
+
winners: `0x${string}`[];
|
|
756
|
+
amounts: bigint[];
|
|
757
|
+
signature: `0x${string}`;
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* EpochPrizePool.executeSignedSettlement — permissionless relay of an
|
|
761
|
+
* operator-signed podium (sdk#664 E1b). Series hashed with seriesToBytes32
|
|
762
|
+
* (not this file's toBytes32) so hex-shaped series cannot drift from the chain.
|
|
763
|
+
*/
|
|
764
|
+
declare function buildEpochExecuteSettlementCall(args: EpochExecuteSettlementCallArgs): Call;
|
|
765
|
+
|
|
710
766
|
/**
|
|
711
767
|
* Typed, actionable errors — the Stripe bar (spec §11).
|
|
712
768
|
*
|
|
@@ -778,4 +834,4 @@ declare class NothingToWithdrawError extends PlaymosError {
|
|
|
778
834
|
constructor(detail?: Record<string, unknown>);
|
|
779
835
|
}
|
|
780
836
|
|
|
781
|
-
export { type
|
|
837
|
+
export { type PaymentStatus as $, type ActiveSeriesRound as A, AuthError as B, type Call as C, ConfigError as D, type EscrowHoldInput as E, type ContractConfig as F, type Eip1193Provider as G, type GasConfig as H, type GasMode as I, InsufficientGasError as J, InvalidAmountError as K, type Listing as L, type MarketplaceListInput as M, type Network as N, type OnchainStatus as O, type PlaymosConfig as P, type ListingStatus as Q, type RoundOpenInput as R, type SettleRoundResult as S, type TransferResult as T, type MarketplaceItem as U, type VerifyResult as V, type WebhookEvent as W, type MarketplaceSale as X, MissingFieldError as Y, NothingToWithdrawError as Z, PaymentFailedError as _, type RoundState as a, type PayoutNotice as a0, type PayoutNoticeStatus as a1, PlaymosError as a2, type PlaymosErrorCode as a3, type RetryOptions as a4, type RoundGetVia as a5, type RoundStatus as a6, type WalletConfig as a7, WalletConnectionError as a8, type WalletConnector as a9, WalletTimeoutError as aa, type WebhookEventType as ab, buildEpochExecuteSettlementCall as ac, toBytes32 as ad, type RoundSettleInput as b, type RoundCancelInput as c, type CancelRoundResult as d, type RoundGetResult as e, type PayoutNoticesResult as f, type PrizeBalance as g, type WithdrawResult as h, type AgentWallet as i, type AgentFundResult as j, type EscrowHoldResult as k, type EscrowResolveResult as l, type MarketplaceSaleResult as m, type MarketplaceGetResult as n, type PayInput as o, type Payment as p, type EnterRoundInput as q, type TransferReconcile as r, type WaitOptions as s, type TransferInput as t, type TransferConfirmOptions as u, type PayoutRule as v, type ActiveForSeriesResult as w, type AgentEconomyConfig as x, AlreadyEnteredError as y, ApiError as z };
|