@playmos/sdk 0.3.12 → 0.3.14
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 +11 -0
- package/LICENSE +21 -0
- package/README.md +33 -15
- package/dist/{errors-CYKgt2VU.d.cts → errors-WcDNfb4q.d.cts} +7 -0
- package/dist/{errors-CYKgt2VU.d.ts → errors-WcDNfb4q.d.ts} +7 -0
- package/dist/index.cjs +42 -9
- package/dist/index.d.cts +23 -5
- package/dist/index.d.ts +23 -5
- package/dist/index.js +44 -12
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/package.json +4 -3
- /package/dist/{chunk-2CW4U5YB.js → chunk-TZFGZNXV.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ All notable changes to `@playmos/sdk`. This project adheres to [Semantic Version
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## [0.3.14] — 2026-09-11
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- **`settle: "server"`** on `new Playmos({ ... })` — explicit sandbox no-wallet path. `pay()` / `enterRound()` server-settle even when MetaMask is installed. Live keys throw. Default without the ask is unchanged (wallet present → player signs).
|
|
11
|
+
|
|
12
|
+
## [0.3.13] — 2026-09-11
|
|
13
|
+
|
|
14
|
+
### Docs
|
|
15
|
+
- Same-studio key rule (`payment not found`). `payoutAddress` at mint or `POST /v1/studio/payout`. Browser `pay()` + MetaMask catch. Webhook register: `POST /v1/webhook_endpoints` (no signing secret in the response).
|
|
16
|
+
- npm README + package description name the live prepare → sign → register path (**flat 1%**). Types include `bytecode` / `unsignedTx`.
|
|
17
|
+
|
|
7
18
|
## [0.3.12] — 2026-08-27
|
|
8
19
|
|
|
9
20
|
### Added
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Playmos Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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
|
|
5
|
+
Stablecoin payments for games on Base. **One default path:** `pay()` → `verify()` → a real `pay_…` id with status `confirmed` (1% Playmos — you keep 99%). No game required. Contests, economies, and timers are **optional**. Skill contests are **flat 1%** on **your** pool. If `rounds.open` is refused, that is expected until you prepare → sign → register your own contest pool. 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
|
|
|
@@ -23,11 +23,11 @@ The sandbox API also sends CORS headers so browser `pay()` / `enterRound()` work
|
|
|
23
23
|
|
|
24
24
|
## Quickstart — the no-wallet sandbox
|
|
25
25
|
|
|
26
|
-
The public sandbox key `pk_test_playmos_sandbox` runs against a real Playmos test service on Base Sepolia. **You don't need a wallet:**
|
|
26
|
+
The public sandbox key `pk_test_playmos_sandbox` runs against a real Playmos test service on Base Sepolia. **You don't need a wallet:** set `settle: "server"` (the quickstart does). The SDK then server-settles even if MetaMask is installed. You still get a real, confirmed `txHash` — signed by the service. No wallet, no gas, no crypto. Omit `settle` only when you want the player to sign.
|
|
27
27
|
|
|
28
|
-
The key
|
|
28
|
+
The public key is wired to `game_sandbox_iap`. Skill entry (`game_sandbox_skill`) is an optional later path — not the first-hour default.
|
|
29
29
|
|
|
30
|
-
### In-app purchase — `pay()`
|
|
30
|
+
### In-app purchase — `pay()` (the front door)
|
|
31
31
|
|
|
32
32
|
<!-- snippet:pay -->
|
|
33
33
|
```ts
|
|
@@ -35,18 +35,25 @@ import { Playmos } from "@playmos/sdk";
|
|
|
35
35
|
|
|
36
36
|
// Public sandbox key — client-safe, like Stripe's pk_test_.
|
|
37
37
|
// No wallet needed: Playmos server-settles the test payment for you.
|
|
38
|
-
const playmos = new Playmos({ apiKey: "pk_test_playmos_sandbox" });
|
|
38
|
+
const playmos = new Playmos({ apiKey: "pk_test_playmos_sandbox", settle: "server" });
|
|
39
39
|
|
|
40
40
|
const payment = await playmos.pay({
|
|
41
|
-
gameId: "game_sandbox_iap", //
|
|
41
|
+
gameId: "game_sandbox_iap", // required for the public sandbox key
|
|
42
42
|
amount: "0.99", // USD string — sandbox server-settle cap $1.00/request
|
|
43
43
|
sku: "gems_500", // your product id
|
|
44
|
-
playerId: "
|
|
44
|
+
playerId: "player_" + Date.now(),
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
let result = await playmos.verify(payment.id);
|
|
48
|
+
let tries = 30;
|
|
49
|
+
while (result.status !== "confirmed" && tries !== 0) {
|
|
50
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
51
|
+
result = await playmos.verify(payment.id);
|
|
52
|
+
tries -= 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
console.log({ id: payment.id, status: result.status, tx: payment.txHash });
|
|
56
|
+
// You won: pay_… + confirmed on Base Sepolia
|
|
50
57
|
```
|
|
51
58
|
|
|
52
59
|
### Verify before you grant
|
|
@@ -68,7 +75,7 @@ if (result.status === "confirmed") {
|
|
|
68
75
|
}
|
|
69
76
|
```
|
|
70
77
|
|
|
71
|
-
###
|
|
78
|
+
### Optional later — skill-game entry (`enterRound()`)
|
|
72
79
|
|
|
73
80
|
```ts
|
|
74
81
|
const entry = await playmos.enterRound({
|
|
@@ -77,10 +84,21 @@ const entry = await playmos.enterRound({
|
|
|
77
84
|
amount: "1.00", // grows this round's pool
|
|
78
85
|
playerId: "player_abc",
|
|
79
86
|
});
|
|
80
|
-
// entry.status === "confirmed"
|
|
81
|
-
//
|
|
87
|
+
// entry.status === "confirmed". Public sandbox skill is a shared Playmos pool — not your contest.
|
|
88
|
+
// Your 1% contest is live only after you register your own pool (next section).
|
|
82
89
|
```
|
|
83
90
|
|
|
91
|
+
### Your own contest pool — `epochs.preparePool` (you sign)
|
|
92
|
+
|
|
93
|
+
`@playmos/sdk` **0.3.14** ships `epochs.preparePool` with `bytecode` / `unsignedTx` on the typed response. It calls the live API. Playmos sets `broadcast: false` and does **not** send the transaction.
|
|
94
|
+
|
|
95
|
+
1. Fund your studio wallet on Base Sepolia (ETH + test USDC). Playmos has no faucet — use [Coinbase's faucet docs](https://docs.cdp.coinbase.com/faucets/introduction/welcome).
|
|
96
|
+
2. Call `epochs.preparePool({ studioWallet })` or `POST /v1/epochs/pools/prepare`. Use `feeSink` from that response (`0xD84c190085aa59c48a9B478Ea333D50B8DF4aD42`).
|
|
97
|
+
3. Sign `unsignedTx` in your wallet and send it.
|
|
98
|
+
4. `epochs.registerPool` with `walletProof`, then open / enter **your** game — not the shared sandbox game.
|
|
99
|
+
|
|
100
|
+
Full steps: https://playmos-docs-public.vercel.app/docs#studio-pool-prepare
|
|
101
|
+
|
|
84
102
|
### Move USDC between wallets — `transfer()`
|
|
85
103
|
|
|
86
104
|
The base value-movement primitive: move USDC from one wallet to another with a configurable per-call fee. The **game logic is the authority** — you already decided the move is valid — so this is a direct, unconditional push (reach for `escrow`/`marketplace` when a trust boundary needs fair exchange). Settled through the on-chain `PlaymosTransfer` contract; the split is verifiable on BaseScan.
|
|
@@ -281,8 +299,8 @@ The escrow/marketplace resolve endpoints (release/refund/confirm) return a deter
|
|
|
281
299
|
|
|
282
300
|
## Docs
|
|
283
301
|
|
|
284
|
-
Full developer docs (install, IAP `pay()`, skill `enterRound()`, agents, webhooks, REST) — **public, no login**:
|
|
302
|
+
Full developer docs (install, IAP `pay()`, skill `enterRound()`, your own contest pool, agents, webhooks, REST) — **public, no login**:
|
|
285
303
|
|
|
286
|
-
**https://playmos-docs-public.vercel.app/docs**
|
|
304
|
+
**https://playmos-docs-public.vercel.app/docs** · contest pool: **https://playmos-docs-public.vercel.app/docs#studio-pool-prepare**
|
|
287
305
|
|
|
288
306
|
That is the third-party / stranger surface while we stress-test. Production **`playmos.io/docs`** comes after Founder promote (gate still holds for production only).
|
|
@@ -76,6 +76,13 @@ interface PlaymosConfig {
|
|
|
76
76
|
* even mock results use the REAL status union (never a synthetic "mocked").
|
|
77
77
|
*/
|
|
78
78
|
mock?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Explicit sandbox no-wallet path. On a test key, `pay()` / `enterRound()`
|
|
81
|
+
* server-settle even if MetaMask (or another injected wallet) is installed.
|
|
82
|
+
* Live keys (`pk_live_` / `sk_live_`) throw — never server-settle real money.
|
|
83
|
+
* Omit to keep today's default: server-settle only when no wallet is present.
|
|
84
|
+
*/
|
|
85
|
+
settle?: "server";
|
|
79
86
|
/**
|
|
80
87
|
* Automatic backoff/retry on HTTP 429 (throttling). Default ON (up to 2 retries,
|
|
81
88
|
* honoring a `Retry-After` header). Retries are safe — reads are idempotent and
|
|
@@ -76,6 +76,13 @@ interface PlaymosConfig {
|
|
|
76
76
|
* even mock results use the REAL status union (never a synthetic "mocked").
|
|
77
77
|
*/
|
|
78
78
|
mock?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Explicit sandbox no-wallet path. On a test key, `pay()` / `enterRound()`
|
|
81
|
+
* server-settle even if MetaMask (or another injected wallet) is installed.
|
|
82
|
+
* Live keys (`pk_live_` / `sk_live_`) throw — never server-settle real money.
|
|
83
|
+
* Omit to keep today's default: server-settle only when no wallet is present.
|
|
84
|
+
*/
|
|
85
|
+
settle?: "server";
|
|
79
86
|
/**
|
|
80
87
|
* Automatic backoff/retry on HTTP 429 (throttling). Default ON (up to 2 retries,
|
|
81
88
|
* honoring a `Retry-After` header). Retries are safe — reads are idempotent and
|
package/dist/index.cjs
CHANGED
|
@@ -1118,7 +1118,8 @@ function mockVerifyResult(payment) {
|
|
|
1118
1118
|
}
|
|
1119
1119
|
|
|
1120
1120
|
// src/epochs.ts
|
|
1121
|
-
var PLAYMOS_FEE_SINK_DEFAULT = "
|
|
1121
|
+
var PLAYMOS_FEE_SINK_DEFAULT = "0xd84c190085aa59c48a9b478ea333d50b8df4ad42";
|
|
1122
|
+
var RETIRED_PLAYMOS_FEE_SINK = "0x1b8031e20ed96131a849a52290b4d640f286998d";
|
|
1122
1123
|
var EPOCH_POOL_CONSTRUCTOR_TYPES = [
|
|
1123
1124
|
{ type: "address" },
|
|
1124
1125
|
{ type: "address" },
|
|
@@ -1305,13 +1306,17 @@ function sameAddr(a, b) {
|
|
|
1305
1306
|
}
|
|
1306
1307
|
function prepareStudioPoolLocal(input, playmosFeeSink, token, playmosAddresses = []) {
|
|
1307
1308
|
const studio = requireAddr(input.studioWallet, "studioWallet");
|
|
1308
|
-
const
|
|
1309
|
+
const locked = PLAYMOS_FEE_SINK_DEFAULT;
|
|
1310
|
+
if (playmosFeeSink && !sameAddr(playmosFeeSink, locked)) {
|
|
1311
|
+
throw new ConfigError("feeSink must equal the Playmos Sepolia treasury; refused before broadcast");
|
|
1312
|
+
}
|
|
1313
|
+
const sink = locked;
|
|
1309
1314
|
const forbidden = [sink, ...playmosAddresses.map((a) => a.toLowerCase())];
|
|
1310
1315
|
if (forbidden.some((a) => sameAddr(a, studio))) {
|
|
1311
1316
|
throw new ConfigError("studioWallet must not be a Playmos address (Playmos never holds studio keys)");
|
|
1312
1317
|
}
|
|
1313
1318
|
if (input.feeSink && !sameAddr(input.feeSink, sink)) {
|
|
1314
|
-
throw new ConfigError("feeSink must equal the Playmos
|
|
1319
|
+
throw new ConfigError("feeSink must equal the Playmos Sepolia treasury; refused before broadcast");
|
|
1315
1320
|
}
|
|
1316
1321
|
if (input.admin && !sameAddr(input.admin, studio)) {
|
|
1317
1322
|
throw new ConfigError("admin must be the studio wallet from block one");
|
|
@@ -1342,6 +1347,7 @@ function prepareStudioPoolLocal(input, playmosFeeSink, token, playmosAddresses =
|
|
|
1342
1347
|
feeSink: sink,
|
|
1343
1348
|
refundTimeout
|
|
1344
1349
|
}),
|
|
1350
|
+
broadcast: false,
|
|
1345
1351
|
constructor: "EpochPrizePool",
|
|
1346
1352
|
studioHoldsAdmin: true,
|
|
1347
1353
|
studioHoldsOperator: true,
|
|
@@ -1546,8 +1552,11 @@ function createEpochsApi(deps) {
|
|
|
1546
1552
|
async preparePool(input) {
|
|
1547
1553
|
const studioWallet = requireAddr(input?.studioWallet, "studioWallet");
|
|
1548
1554
|
const cfg = deps.config();
|
|
1549
|
-
const sink =
|
|
1555
|
+
const sink = PLAYMOS_FEE_SINK_DEFAULT;
|
|
1550
1556
|
const token = (input.token ?? cfg.contracts?.usdc ?? "0x036cbd53842c5426634e7929541ec2318f3dcf7e").toLowerCase();
|
|
1557
|
+
if (input.playmosFeeSink && !sameAddr(input.playmosFeeSink, sink)) {
|
|
1558
|
+
throw new ConfigError("feeSink must equal the Playmos Sepolia treasury; refused before broadcast");
|
|
1559
|
+
}
|
|
1551
1560
|
if (cfg.mock) {
|
|
1552
1561
|
return prepareStudioPoolLocal({ ...input, studioWallet }, sink, token);
|
|
1553
1562
|
}
|
|
@@ -2253,7 +2262,7 @@ var Playmos = class {
|
|
|
2253
2262
|
},
|
|
2254
2263
|
walletAddress: async () => getAccount(this.walletProvider()),
|
|
2255
2264
|
readView: async (to, data) => {
|
|
2256
|
-
if (await walletAvailable(this.config.wallet, this.walletTimeoutPolicy())) {
|
|
2265
|
+
if (!await this.shouldServerSettle() && await walletAvailable(this.config.wallet, this.walletTimeoutPolicy())) {
|
|
2257
2266
|
const provider = this.walletProvider();
|
|
2258
2267
|
return await provider.request({
|
|
2259
2268
|
method: "eth_call",
|
|
@@ -3354,8 +3363,14 @@ var Playmos = class {
|
|
|
3354
3363
|
);
|
|
3355
3364
|
}
|
|
3356
3365
|
}
|
|
3366
|
+
if (config.settle === "server" && !this.env.isTest) {
|
|
3367
|
+
throw new ConfigError(
|
|
3368
|
+
'settle: "server" is sandbox-only. Live keys must use a player wallet \u2014 never server-settle real money.',
|
|
3369
|
+
{ field: "settle" }
|
|
3370
|
+
);
|
|
3371
|
+
}
|
|
3357
3372
|
this.http = createHttpClient(this.env.apiBaseUrl, config.apiKey, config.retry);
|
|
3358
|
-
if (!config.mock) {
|
|
3373
|
+
if (!config.mock && config.settle !== "server") {
|
|
3359
3374
|
try {
|
|
3360
3375
|
resolveProvider(config.wallet, this.walletTimeoutPolicy());
|
|
3361
3376
|
} catch {
|
|
@@ -3425,6 +3440,23 @@ var Playmos = class {
|
|
|
3425
3440
|
return 0n;
|
|
3426
3441
|
}
|
|
3427
3442
|
}
|
|
3443
|
+
/**
|
|
3444
|
+
* Sandbox server-settle when the developer asked (`settle: "server"`) or when
|
|
3445
|
+
* a test key has no wallet. Never calls walletAvailable if the ask is set —
|
|
3446
|
+
* that is the MetaMask-hijack delete (Moonhop leftover Slice 1).
|
|
3447
|
+
*/
|
|
3448
|
+
async shouldServerSettle() {
|
|
3449
|
+
if (this.config.settle === "server") {
|
|
3450
|
+
if (!this.env.isTest) {
|
|
3451
|
+
throw new ConfigError(
|
|
3452
|
+
'settle: "server" is sandbox-only. Live keys must use a player wallet \u2014 never server-settle real money.',
|
|
3453
|
+
{ field: "settle" }
|
|
3454
|
+
);
|
|
3455
|
+
}
|
|
3456
|
+
return true;
|
|
3457
|
+
}
|
|
3458
|
+
return this.env.isTest && !await walletAvailable(this.config.wallet, this.walletTimeoutPolicy());
|
|
3459
|
+
}
|
|
3428
3460
|
/**
|
|
3429
3461
|
* Wallet timeout policy (#462 / PR #463 residual).
|
|
3430
3462
|
* - connectTimeoutMs → eth_requestAccounts only
|
|
@@ -3552,7 +3584,7 @@ var Playmos = class {
|
|
|
3552
3584
|
heldIdem ? { key: heldIdem, terms } : void 0
|
|
3553
3585
|
);
|
|
3554
3586
|
}
|
|
3555
|
-
if (
|
|
3587
|
+
if (await this.shouldServerSettle()) {
|
|
3556
3588
|
const res = await this.http.post(
|
|
3557
3589
|
"/payments",
|
|
3558
3590
|
{
|
|
@@ -3657,7 +3689,7 @@ var Playmos = class {
|
|
|
3657
3689
|
heldIdem ? { key: heldIdem, terms } : void 0
|
|
3658
3690
|
);
|
|
3659
3691
|
}
|
|
3660
|
-
const serverSettleNoWallet =
|
|
3692
|
+
const serverSettleNoWallet = await this.shouldServerSettle();
|
|
3661
3693
|
if (!serverSettleNoWallet) {
|
|
3662
3694
|
const pinned = typeof input.identity === "string" ? input.identity.trim() : "";
|
|
3663
3695
|
if (!pinned) {
|
|
@@ -3987,7 +4019,7 @@ var Playmos = class {
|
|
|
3987
4019
|
});
|
|
3988
4020
|
let raw;
|
|
3989
4021
|
try {
|
|
3990
|
-
if (await walletAvailable(this.config.wallet, this.walletTimeoutPolicy())) {
|
|
4022
|
+
if (!await this.shouldServerSettle() && await walletAvailable(this.config.wallet, this.walletTimeoutPolicy())) {
|
|
3991
4023
|
const provider = this.walletProvider();
|
|
3992
4024
|
raw = await provider.request({
|
|
3993
4025
|
method: "eth_call",
|
|
@@ -4216,6 +4248,7 @@ exports.PaymentFailedError = PaymentFailedError;
|
|
|
4216
4248
|
exports.PayoutError = PayoutError;
|
|
4217
4249
|
exports.Playmos = Playmos;
|
|
4218
4250
|
exports.PlaymosError = PlaymosError;
|
|
4251
|
+
exports.RETIRED_PLAYMOS_FEE_SINK = RETIRED_PLAYMOS_FEE_SINK;
|
|
4219
4252
|
exports.USDC_ADDRESS = USDC_ADDRESS;
|
|
4220
4253
|
exports.USDC_DECIMALS = USDC_DECIMALS;
|
|
4221
4254
|
exports.WalletConnectionError = WalletConnectionError;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Call, P as PlaymosConfig, O as OnchainStatus, N as Network, W as WebhookEvent, R as RoundOpenInput, a as RoundState, b as RoundSettleInput, S as SettleRoundResult, c as RoundCancelInput, d as CancelRoundResult, e as RoundGetResult, A as ActiveSeriesRound, f as PayoutNoticesResult, g as PrizeBalance, h as WithdrawResult, i as AgentWallet, j as AgentFundResult, T as TransferResult, E as EscrowHoldInput, k as EscrowHoldResult, l as EscrowResolveResult, M as MarketplaceListInput, L as Listing, m as MarketplaceSaleResult, n as MarketplaceGetResult, o as PayInput, p as Payment, q as EnterRoundInput, r as TransferReconcile, s as WaitOptions, t as TransferInput, u as TransferConfirmOptions, V as VerifyResult, v as PayoutRule } from './errors-
|
|
2
|
-
export { w as ActiveForSeriesResult, x as AgentEconomyConfig, y as AlreadyEnteredError, z as ApiError, B as AuthError, D as ConfigError, F as ContractConfig, G as Eip1193Provider, H as GasConfig, I as GasMode, J as InsufficientGasError, K as InvalidAmountError, Q as ListingStatus, U as MarketplaceItem, X as MarketplaceSale, Y as MissingFieldError, Z as NothingToWithdrawError, _ as PaymentFailedError, $ as PaymentStatus, a0 as PayoutNotice, a1 as PayoutNoticeStatus, a2 as PlaymosError, a3 as PlaymosErrorCode, a4 as RetryOptions, a5 as RoundGetVia, a6 as RoundStatus, a7 as WalletConfig, a8 as WalletConnectionError, a9 as WalletConnector, aa as WalletTimeoutError, ab as WebhookEventType, ac as buildEpochExecuteSettlementCall } from './errors-
|
|
1
|
+
import { C as Call, P as PlaymosConfig, O as OnchainStatus, N as Network, W as WebhookEvent, R as RoundOpenInput, a as RoundState, b as RoundSettleInput, S as SettleRoundResult, c as RoundCancelInput, d as CancelRoundResult, e as RoundGetResult, A as ActiveSeriesRound, f as PayoutNoticesResult, g as PrizeBalance, h as WithdrawResult, i as AgentWallet, j as AgentFundResult, T as TransferResult, E as EscrowHoldInput, k as EscrowHoldResult, l as EscrowResolveResult, M as MarketplaceListInput, L as Listing, m as MarketplaceSaleResult, n as MarketplaceGetResult, o as PayInput, p as Payment, q as EnterRoundInput, r as TransferReconcile, s as WaitOptions, t as TransferInput, u as TransferConfirmOptions, V as VerifyResult, v as PayoutRule } from './errors-WcDNfb4q.cjs';
|
|
2
|
+
export { w as ActiveForSeriesResult, x as AgentEconomyConfig, y as AlreadyEnteredError, z as ApiError, B as AuthError, D as ConfigError, F as ContractConfig, G as Eip1193Provider, H as GasConfig, I as GasMode, J as InsufficientGasError, K as InvalidAmountError, Q as ListingStatus, U as MarketplaceItem, X as MarketplaceSale, Y as MissingFieldError, Z as NothingToWithdrawError, _ as PaymentFailedError, $ as PaymentStatus, a0 as PayoutNotice, a1 as PayoutNoticeStatus, a2 as PlaymosError, a3 as PlaymosErrorCode, a4 as RetryOptions, a5 as RoundGetVia, a6 as RoundStatus, a7 as WalletConfig, a8 as WalletConnectionError, a9 as WalletConnector, aa as WalletTimeoutError, ab as WebhookEventType, ac as buildEpochExecuteSettlementCall } from './errors-WcDNfb4q.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Thin REST client for the Playmos service. Every SDK method that touches the
|
|
@@ -100,8 +100,10 @@ declare function buildEpochWithdrawCall(epochPrizePool: `0x${string}`): Call;
|
|
|
100
100
|
* `terminal`. Live `rounds.*` / `enterRound` are a different pool and stay unchanged.
|
|
101
101
|
*/
|
|
102
102
|
|
|
103
|
-
/** Playmos Base Sepolia
|
|
104
|
-
declare const PLAYMOS_FEE_SINK_DEFAULT: "
|
|
103
|
+
/** Founder-locked Playmos Base Sepolia treasury (Object 3). Prepare pins this. */
|
|
104
|
+
declare const PLAYMOS_FEE_SINK_DEFAULT: "0xd84c190085aa59c48a9b478ea333d50b8df4ad42";
|
|
105
|
+
/** Retired constructor sink — prepare must never hand this out. */
|
|
106
|
+
declare const RETIRED_PLAYMOS_FEE_SINK: "0x1b8031e20ed96131a849a52290b4d640f286998d";
|
|
105
107
|
declare function encodeEpochPoolConstructorArgs(args: {
|
|
106
108
|
token: `0x${string}`;
|
|
107
109
|
admin: `0x${string}`;
|
|
@@ -258,6 +260,16 @@ interface EpochPreparedPool {
|
|
|
258
260
|
feeSink: `0x${string}`;
|
|
259
261
|
refundTimeout: string;
|
|
260
262
|
constructorArgs: `0x${string}`;
|
|
263
|
+
/** Creation bytecode from the service prepare path. Absent on mock. */
|
|
264
|
+
bytecode?: `0x${string}`;
|
|
265
|
+
unsignedTx?: {
|
|
266
|
+
chainId: number;
|
|
267
|
+
to: null;
|
|
268
|
+
value: "0";
|
|
269
|
+
data: `0x${string}`;
|
|
270
|
+
};
|
|
271
|
+
/** Playmos never broadcasts. Studio wallet sends. */
|
|
272
|
+
broadcast: false;
|
|
261
273
|
constructor: "EpochPrizePool";
|
|
262
274
|
studioHoldsAdmin: true;
|
|
263
275
|
studioHoldsOperator: true;
|
|
@@ -1311,6 +1323,12 @@ declare class Playmos {
|
|
|
1311
1323
|
*/
|
|
1312
1324
|
private readonly mockByIdempotencyKey;
|
|
1313
1325
|
constructor(config: PlaymosConfig);
|
|
1326
|
+
/**
|
|
1327
|
+
* Sandbox server-settle when the developer asked (`settle: "server"`) or when
|
|
1328
|
+
* a test key has no wallet. Never calls walletAvailable if the ask is set —
|
|
1329
|
+
* that is the MetaMask-hijack delete (Moonhop leftover Slice 1).
|
|
1330
|
+
*/
|
|
1331
|
+
private shouldServerSettle;
|
|
1314
1332
|
/**
|
|
1315
1333
|
* Wallet timeout policy (#462 / PR #463 residual).
|
|
1316
1334
|
* - connectTimeoutMs → eth_requestAccounts only
|
|
@@ -1575,4 +1593,4 @@ declare function ulid(seedTime?: number): string;
|
|
|
1575
1593
|
/** `${prefix}_${ulid()}` — e.g. `pay_01J…`, `entry_01J…`, `idem_01J…`. */
|
|
1576
1594
|
declare function prefixedId(prefix: string): string;
|
|
1577
1595
|
|
|
1578
|
-
export { ActiveSeriesRound, AgentFundResult, AgentWallet, type Authorization, C1_ENTER_SPLIT_MICRO, CHAIN_ID, CancelRoundResult, type CreatePaymentRequirementInput, DEFAULT_API_BASE_URL, EnterRoundInput, type EpochAttestation, type EpochClaimRefundInput, type EpochClaimRefundResult, type EpochClaimableRefund, type EpochClaimableRefundInput, type EpochCreatePoolInput, type EpochCurrentId, type EpochCurrentIdInput, type EpochEnterInput, type EpochEntry, type EpochEntryStatus, type EpochExecuteSettlementInput, type EpochExecuteSettlementResult, type EpochGetAttestationInput, type EpochGetInput, type EpochGetSeriesInput, type EpochPoolOwnership, type EpochPoolWalletProof, type EpochPreparePoolInput, type EpochPreparedPool, type EpochPrize, type EpochPrizeInput, type EpochReadVia, type EpochRegisterPoolInput, type EpochSeriesView, type EpochSettleInput, type EpochSettleResult, type EpochSettleStatus, type EpochSettleWinner, type EpochStudioPool, type EpochTerminal, type EpochView, type EpochWinnerIn, type EpochWithdrawInput, type EpochWithdrawResult, type EpochsApi, EscrowHoldInput, EscrowHoldResult, EscrowResolveResult, Listing, MICRO_PER_USDC, MarketplaceGetResult, MarketplaceListInput, MarketplaceSaleResult, Network, PLAYMOS_FEE_SINK_DEFAULT, PayInput, Payment, type PaymentRequirement, PayoutError, PayoutNoticesResult, PayoutRule, PayoutRule as PayoutRuleCompute, Playmos, PlaymosConfig, PrizeBalance, RoundCancelInput, RoundGetResult, RoundOpenInput, RoundSettleInput, RoundState, SettleRoundResult, type SettlementAsset, type SettlementTypedData, type SettlementTypedDataInput, TransferConfirmOptions, TransferInput, TransferReconcile, TransferResult, USDC_ADDRESS, USDC_DECIMALS, VerifyResult, WaitOptions, type WalletSignatureAuthorization, WebhookEvent, WithdrawResult, type X402ChallengeInput, type X402ChallengeResult, type X402FulfillAuthorization, type X402PayInput, type X402PayloadAuthorization, type X402PayloadMode, type X402PaymentRequired, type X402SettleResult, buildEpochClaimRefundCall, buildEpochEntryCalls, buildEpochWithdrawCall, clientRuntimeSignals, computeIapSplit, computePayout, computePoolSplit, createEpochsApi, createPaymentRequirement, createX402Challenge, decodePaymentHeader, derivedEpochId, encodeEpochPoolConstructorArgs, encodePaymentHeader, epochPayableMicro, epochPoolProofMessage, formatMicroToUsd, identityToBytes32, isClientRuntime, isWalletSignatureAuthorization, isX402PayloadAuthorization, networkToCaip2, parsePaymentRequirement, parseUsdToMicro, prefixedId, prepareStudioPoolLocal, previewEscrowFee, previewIapSplit, previewMarketplaceSplit, previewPoolSplit, previewTransferSplit, resolveEnv, serializePaymentRequirement, seriesToBytes32, settlementTypedData, toX402PaymentRequired, ulid, validateX402ChallengeInput };
|
|
1596
|
+
export { ActiveSeriesRound, AgentFundResult, AgentWallet, type Authorization, C1_ENTER_SPLIT_MICRO, CHAIN_ID, CancelRoundResult, type CreatePaymentRequirementInput, DEFAULT_API_BASE_URL, EnterRoundInput, type EpochAttestation, type EpochClaimRefundInput, type EpochClaimRefundResult, type EpochClaimableRefund, type EpochClaimableRefundInput, type EpochCreatePoolInput, type EpochCurrentId, type EpochCurrentIdInput, type EpochEnterInput, type EpochEntry, type EpochEntryStatus, type EpochExecuteSettlementInput, type EpochExecuteSettlementResult, type EpochGetAttestationInput, type EpochGetInput, type EpochGetSeriesInput, type EpochPoolOwnership, type EpochPoolWalletProof, type EpochPreparePoolInput, type EpochPreparedPool, type EpochPrize, type EpochPrizeInput, type EpochReadVia, type EpochRegisterPoolInput, type EpochSeriesView, type EpochSettleInput, type EpochSettleResult, type EpochSettleStatus, type EpochSettleWinner, type EpochStudioPool, type EpochTerminal, type EpochView, type EpochWinnerIn, type EpochWithdrawInput, type EpochWithdrawResult, type EpochsApi, EscrowHoldInput, EscrowHoldResult, EscrowResolveResult, Listing, MICRO_PER_USDC, MarketplaceGetResult, MarketplaceListInput, MarketplaceSaleResult, Network, PLAYMOS_FEE_SINK_DEFAULT, PayInput, Payment, type PaymentRequirement, PayoutError, PayoutNoticesResult, PayoutRule, PayoutRule as PayoutRuleCompute, Playmos, PlaymosConfig, PrizeBalance, RETIRED_PLAYMOS_FEE_SINK, RoundCancelInput, RoundGetResult, RoundOpenInput, RoundSettleInput, RoundState, SettleRoundResult, type SettlementAsset, type SettlementTypedData, type SettlementTypedDataInput, TransferConfirmOptions, TransferInput, TransferReconcile, TransferResult, USDC_ADDRESS, USDC_DECIMALS, VerifyResult, WaitOptions, type WalletSignatureAuthorization, WebhookEvent, WithdrawResult, type X402ChallengeInput, type X402ChallengeResult, type X402FulfillAuthorization, type X402PayInput, type X402PayloadAuthorization, type X402PayloadMode, type X402PaymentRequired, type X402SettleResult, buildEpochClaimRefundCall, buildEpochEntryCalls, buildEpochWithdrawCall, clientRuntimeSignals, computeIapSplit, computePayout, computePoolSplit, createEpochsApi, createPaymentRequirement, createX402Challenge, decodePaymentHeader, derivedEpochId, encodeEpochPoolConstructorArgs, encodePaymentHeader, epochPayableMicro, epochPoolProofMessage, formatMicroToUsd, identityToBytes32, isClientRuntime, isWalletSignatureAuthorization, isX402PayloadAuthorization, networkToCaip2, parsePaymentRequirement, parseUsdToMicro, prefixedId, prepareStudioPoolLocal, previewEscrowFee, previewIapSplit, previewMarketplaceSplit, previewPoolSplit, previewTransferSplit, resolveEnv, serializePaymentRequirement, seriesToBytes32, settlementTypedData, toX402PaymentRequired, ulid, validateX402ChallengeInput };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Call, P as PlaymosConfig, O as OnchainStatus, N as Network, W as WebhookEvent, R as RoundOpenInput, a as RoundState, b as RoundSettleInput, S as SettleRoundResult, c as RoundCancelInput, d as CancelRoundResult, e as RoundGetResult, A as ActiveSeriesRound, f as PayoutNoticesResult, g as PrizeBalance, h as WithdrawResult, i as AgentWallet, j as AgentFundResult, T as TransferResult, E as EscrowHoldInput, k as EscrowHoldResult, l as EscrowResolveResult, M as MarketplaceListInput, L as Listing, m as MarketplaceSaleResult, n as MarketplaceGetResult, o as PayInput, p as Payment, q as EnterRoundInput, r as TransferReconcile, s as WaitOptions, t as TransferInput, u as TransferConfirmOptions, V as VerifyResult, v as PayoutRule } from './errors-
|
|
2
|
-
export { w as ActiveForSeriesResult, x as AgentEconomyConfig, y as AlreadyEnteredError, z as ApiError, B as AuthError, D as ConfigError, F as ContractConfig, G as Eip1193Provider, H as GasConfig, I as GasMode, J as InsufficientGasError, K as InvalidAmountError, Q as ListingStatus, U as MarketplaceItem, X as MarketplaceSale, Y as MissingFieldError, Z as NothingToWithdrawError, _ as PaymentFailedError, $ as PaymentStatus, a0 as PayoutNotice, a1 as PayoutNoticeStatus, a2 as PlaymosError, a3 as PlaymosErrorCode, a4 as RetryOptions, a5 as RoundGetVia, a6 as RoundStatus, a7 as WalletConfig, a8 as WalletConnectionError, a9 as WalletConnector, aa as WalletTimeoutError, ab as WebhookEventType, ac as buildEpochExecuteSettlementCall } from './errors-
|
|
1
|
+
import { C as Call, P as PlaymosConfig, O as OnchainStatus, N as Network, W as WebhookEvent, R as RoundOpenInput, a as RoundState, b as RoundSettleInput, S as SettleRoundResult, c as RoundCancelInput, d as CancelRoundResult, e as RoundGetResult, A as ActiveSeriesRound, f as PayoutNoticesResult, g as PrizeBalance, h as WithdrawResult, i as AgentWallet, j as AgentFundResult, T as TransferResult, E as EscrowHoldInput, k as EscrowHoldResult, l as EscrowResolveResult, M as MarketplaceListInput, L as Listing, m as MarketplaceSaleResult, n as MarketplaceGetResult, o as PayInput, p as Payment, q as EnterRoundInput, r as TransferReconcile, s as WaitOptions, t as TransferInput, u as TransferConfirmOptions, V as VerifyResult, v as PayoutRule } from './errors-WcDNfb4q.js';
|
|
2
|
+
export { w as ActiveForSeriesResult, x as AgentEconomyConfig, y as AlreadyEnteredError, z as ApiError, B as AuthError, D as ConfigError, F as ContractConfig, G as Eip1193Provider, H as GasConfig, I as GasMode, J as InsufficientGasError, K as InvalidAmountError, Q as ListingStatus, U as MarketplaceItem, X as MarketplaceSale, Y as MissingFieldError, Z as NothingToWithdrawError, _ as PaymentFailedError, $ as PaymentStatus, a0 as PayoutNotice, a1 as PayoutNoticeStatus, a2 as PlaymosError, a3 as PlaymosErrorCode, a4 as RetryOptions, a5 as RoundGetVia, a6 as RoundStatus, a7 as WalletConfig, a8 as WalletConnectionError, a9 as WalletConnector, aa as WalletTimeoutError, ab as WebhookEventType, ac as buildEpochExecuteSettlementCall } from './errors-WcDNfb4q.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Thin REST client for the Playmos service. Every SDK method that touches the
|
|
@@ -100,8 +100,10 @@ declare function buildEpochWithdrawCall(epochPrizePool: `0x${string}`): Call;
|
|
|
100
100
|
* `terminal`. Live `rounds.*` / `enterRound` are a different pool and stay unchanged.
|
|
101
101
|
*/
|
|
102
102
|
|
|
103
|
-
/** Playmos Base Sepolia
|
|
104
|
-
declare const PLAYMOS_FEE_SINK_DEFAULT: "
|
|
103
|
+
/** Founder-locked Playmos Base Sepolia treasury (Object 3). Prepare pins this. */
|
|
104
|
+
declare const PLAYMOS_FEE_SINK_DEFAULT: "0xd84c190085aa59c48a9b478ea333d50b8df4ad42";
|
|
105
|
+
/** Retired constructor sink — prepare must never hand this out. */
|
|
106
|
+
declare const RETIRED_PLAYMOS_FEE_SINK: "0x1b8031e20ed96131a849a52290b4d640f286998d";
|
|
105
107
|
declare function encodeEpochPoolConstructorArgs(args: {
|
|
106
108
|
token: `0x${string}`;
|
|
107
109
|
admin: `0x${string}`;
|
|
@@ -258,6 +260,16 @@ interface EpochPreparedPool {
|
|
|
258
260
|
feeSink: `0x${string}`;
|
|
259
261
|
refundTimeout: string;
|
|
260
262
|
constructorArgs: `0x${string}`;
|
|
263
|
+
/** Creation bytecode from the service prepare path. Absent on mock. */
|
|
264
|
+
bytecode?: `0x${string}`;
|
|
265
|
+
unsignedTx?: {
|
|
266
|
+
chainId: number;
|
|
267
|
+
to: null;
|
|
268
|
+
value: "0";
|
|
269
|
+
data: `0x${string}`;
|
|
270
|
+
};
|
|
271
|
+
/** Playmos never broadcasts. Studio wallet sends. */
|
|
272
|
+
broadcast: false;
|
|
261
273
|
constructor: "EpochPrizePool";
|
|
262
274
|
studioHoldsAdmin: true;
|
|
263
275
|
studioHoldsOperator: true;
|
|
@@ -1311,6 +1323,12 @@ declare class Playmos {
|
|
|
1311
1323
|
*/
|
|
1312
1324
|
private readonly mockByIdempotencyKey;
|
|
1313
1325
|
constructor(config: PlaymosConfig);
|
|
1326
|
+
/**
|
|
1327
|
+
* Sandbox server-settle when the developer asked (`settle: "server"`) or when
|
|
1328
|
+
* a test key has no wallet. Never calls walletAvailable if the ask is set —
|
|
1329
|
+
* that is the MetaMask-hijack delete (Moonhop leftover Slice 1).
|
|
1330
|
+
*/
|
|
1331
|
+
private shouldServerSettle;
|
|
1314
1332
|
/**
|
|
1315
1333
|
* Wallet timeout policy (#462 / PR #463 residual).
|
|
1316
1334
|
* - connectTimeoutMs → eth_requestAccounts only
|
|
@@ -1575,4 +1593,4 @@ declare function ulid(seedTime?: number): string;
|
|
|
1575
1593
|
/** `${prefix}_${ulid()}` — e.g. `pay_01J…`, `entry_01J…`, `idem_01J…`. */
|
|
1576
1594
|
declare function prefixedId(prefix: string): string;
|
|
1577
1595
|
|
|
1578
|
-
export { ActiveSeriesRound, AgentFundResult, AgentWallet, type Authorization, C1_ENTER_SPLIT_MICRO, CHAIN_ID, CancelRoundResult, type CreatePaymentRequirementInput, DEFAULT_API_BASE_URL, EnterRoundInput, type EpochAttestation, type EpochClaimRefundInput, type EpochClaimRefundResult, type EpochClaimableRefund, type EpochClaimableRefundInput, type EpochCreatePoolInput, type EpochCurrentId, type EpochCurrentIdInput, type EpochEnterInput, type EpochEntry, type EpochEntryStatus, type EpochExecuteSettlementInput, type EpochExecuteSettlementResult, type EpochGetAttestationInput, type EpochGetInput, type EpochGetSeriesInput, type EpochPoolOwnership, type EpochPoolWalletProof, type EpochPreparePoolInput, type EpochPreparedPool, type EpochPrize, type EpochPrizeInput, type EpochReadVia, type EpochRegisterPoolInput, type EpochSeriesView, type EpochSettleInput, type EpochSettleResult, type EpochSettleStatus, type EpochSettleWinner, type EpochStudioPool, type EpochTerminal, type EpochView, type EpochWinnerIn, type EpochWithdrawInput, type EpochWithdrawResult, type EpochsApi, EscrowHoldInput, EscrowHoldResult, EscrowResolveResult, Listing, MICRO_PER_USDC, MarketplaceGetResult, MarketplaceListInput, MarketplaceSaleResult, Network, PLAYMOS_FEE_SINK_DEFAULT, PayInput, Payment, type PaymentRequirement, PayoutError, PayoutNoticesResult, PayoutRule, PayoutRule as PayoutRuleCompute, Playmos, PlaymosConfig, PrizeBalance, RoundCancelInput, RoundGetResult, RoundOpenInput, RoundSettleInput, RoundState, SettleRoundResult, type SettlementAsset, type SettlementTypedData, type SettlementTypedDataInput, TransferConfirmOptions, TransferInput, TransferReconcile, TransferResult, USDC_ADDRESS, USDC_DECIMALS, VerifyResult, WaitOptions, type WalletSignatureAuthorization, WebhookEvent, WithdrawResult, type X402ChallengeInput, type X402ChallengeResult, type X402FulfillAuthorization, type X402PayInput, type X402PayloadAuthorization, type X402PayloadMode, type X402PaymentRequired, type X402SettleResult, buildEpochClaimRefundCall, buildEpochEntryCalls, buildEpochWithdrawCall, clientRuntimeSignals, computeIapSplit, computePayout, computePoolSplit, createEpochsApi, createPaymentRequirement, createX402Challenge, decodePaymentHeader, derivedEpochId, encodeEpochPoolConstructorArgs, encodePaymentHeader, epochPayableMicro, epochPoolProofMessage, formatMicroToUsd, identityToBytes32, isClientRuntime, isWalletSignatureAuthorization, isX402PayloadAuthorization, networkToCaip2, parsePaymentRequirement, parseUsdToMicro, prefixedId, prepareStudioPoolLocal, previewEscrowFee, previewIapSplit, previewMarketplaceSplit, previewPoolSplit, previewTransferSplit, resolveEnv, serializePaymentRequirement, seriesToBytes32, settlementTypedData, toX402PaymentRequired, ulid, validateX402ChallengeInput };
|
|
1596
|
+
export { ActiveSeriesRound, AgentFundResult, AgentWallet, type Authorization, C1_ENTER_SPLIT_MICRO, CHAIN_ID, CancelRoundResult, type CreatePaymentRequirementInput, DEFAULT_API_BASE_URL, EnterRoundInput, type EpochAttestation, type EpochClaimRefundInput, type EpochClaimRefundResult, type EpochClaimableRefund, type EpochClaimableRefundInput, type EpochCreatePoolInput, type EpochCurrentId, type EpochCurrentIdInput, type EpochEnterInput, type EpochEntry, type EpochEntryStatus, type EpochExecuteSettlementInput, type EpochExecuteSettlementResult, type EpochGetAttestationInput, type EpochGetInput, type EpochGetSeriesInput, type EpochPoolOwnership, type EpochPoolWalletProof, type EpochPreparePoolInput, type EpochPreparedPool, type EpochPrize, type EpochPrizeInput, type EpochReadVia, type EpochRegisterPoolInput, type EpochSeriesView, type EpochSettleInput, type EpochSettleResult, type EpochSettleStatus, type EpochSettleWinner, type EpochStudioPool, type EpochTerminal, type EpochView, type EpochWinnerIn, type EpochWithdrawInput, type EpochWithdrawResult, type EpochsApi, EscrowHoldInput, EscrowHoldResult, EscrowResolveResult, Listing, MICRO_PER_USDC, MarketplaceGetResult, MarketplaceListInput, MarketplaceSaleResult, Network, PLAYMOS_FEE_SINK_DEFAULT, PayInput, Payment, type PaymentRequirement, PayoutError, PayoutNoticesResult, PayoutRule, PayoutRule as PayoutRuleCompute, Playmos, PlaymosConfig, PrizeBalance, RETIRED_PLAYMOS_FEE_SINK, RoundCancelInput, RoundGetResult, RoundOpenInput, RoundSettleInput, RoundState, SettleRoundResult, type SettlementAsset, type SettlementTypedData, type SettlementTypedDataInput, TransferConfirmOptions, TransferInput, TransferReconcile, TransferResult, USDC_ADDRESS, USDC_DECIMALS, VerifyResult, WaitOptions, type WalletSignatureAuthorization, WebhookEvent, WithdrawResult, type X402ChallengeInput, type X402ChallengeResult, type X402FulfillAuthorization, type X402PayInput, type X402PayloadAuthorization, type X402PayloadMode, type X402PaymentRequired, type X402SettleResult, buildEpochClaimRefundCall, buildEpochEntryCalls, buildEpochWithdrawCall, clientRuntimeSignals, computeIapSplit, computePayout, computePoolSplit, createEpochsApi, createPaymentRequirement, createX402Challenge, decodePaymentHeader, derivedEpochId, encodeEpochPoolConstructorArgs, encodePaymentHeader, epochPayableMicro, epochPoolProofMessage, formatMicroToUsd, identityToBytes32, isClientRuntime, isWalletSignatureAuthorization, isX402PayloadAuthorization, networkToCaip2, parsePaymentRequirement, parseUsdToMicro, prefixedId, prepareStudioPoolLocal, previewEscrowFee, previewIapSplit, previewMarketplaceSplit, previewPoolSplit, previewTransferSplit, resolveEnv, serializePaymentRequirement, seriesToBytes32, settlementTypedData, toX402PaymentRequired, ulid, validateX402ChallengeInput };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AuthError, InvalidAmountError, epochPrizePoolEnterAbi, seriesToBytes32, identityToBytes32, encodeApprove, epochPrizePoolRefundAbi, ConfigError, MissingFieldError, buildEpochExecuteSettlementCall, PaymentFailedError, epochPrizePoolViewAbi, ApiError, assertEnoughGas, sendCalls, waitForCalls, NothingToWithdrawError, buildWithdrawCall, WalletTimeoutError, buildIapCalls, buildEntryCalls, prizePoolAbi, WalletConnectionError, AlreadyEnteredError } from './chunk-
|
|
2
|
-
export { AlreadyEnteredError, ApiError, AuthError, ConfigError, InsufficientGasError, InvalidAmountError, MissingFieldError, NothingToWithdrawError, PaymentFailedError, PlaymosError, WalletConnectionError, WalletTimeoutError, buildEpochExecuteSettlementCall, identityToBytes32, seriesToBytes32 } from './chunk-
|
|
1
|
+
import { AuthError, InvalidAmountError, epochPrizePoolEnterAbi, seriesToBytes32, identityToBytes32, encodeApprove, epochPrizePoolRefundAbi, ConfigError, MissingFieldError, buildEpochExecuteSettlementCall, PaymentFailedError, epochPrizePoolViewAbi, ApiError, assertEnoughGas, sendCalls, waitForCalls, NothingToWithdrawError, buildWithdrawCall, WalletTimeoutError, buildIapCalls, buildEntryCalls, prizePoolAbi, WalletConnectionError, AlreadyEnteredError } from './chunk-TZFGZNXV.js';
|
|
2
|
+
export { AlreadyEnteredError, ApiError, AuthError, ConfigError, InsufficientGasError, InvalidAmountError, MissingFieldError, NothingToWithdrawError, PaymentFailedError, PlaymosError, WalletConnectionError, WalletTimeoutError, buildEpochExecuteSettlementCall, identityToBytes32, seriesToBytes32 } from './chunk-TZFGZNXV.js';
|
|
3
3
|
import { encodeFunctionData, encodeAbiParameters, decodeFunctionResult } from 'viem';
|
|
4
4
|
|
|
5
5
|
// src/config.ts
|
|
@@ -674,7 +674,8 @@ function mockVerifyResult(payment) {
|
|
|
674
674
|
}
|
|
675
675
|
|
|
676
676
|
// src/epochs.ts
|
|
677
|
-
var PLAYMOS_FEE_SINK_DEFAULT = "
|
|
677
|
+
var PLAYMOS_FEE_SINK_DEFAULT = "0xd84c190085aa59c48a9b478ea333d50b8df4ad42";
|
|
678
|
+
var RETIRED_PLAYMOS_FEE_SINK = "0x1b8031e20ed96131a849a52290b4d640f286998d";
|
|
678
679
|
var EPOCH_POOL_CONSTRUCTOR_TYPES = [
|
|
679
680
|
{ type: "address" },
|
|
680
681
|
{ type: "address" },
|
|
@@ -861,13 +862,17 @@ function sameAddr(a, b) {
|
|
|
861
862
|
}
|
|
862
863
|
function prepareStudioPoolLocal(input, playmosFeeSink, token, playmosAddresses = []) {
|
|
863
864
|
const studio = requireAddr(input.studioWallet, "studioWallet");
|
|
864
|
-
const
|
|
865
|
+
const locked = PLAYMOS_FEE_SINK_DEFAULT;
|
|
866
|
+
if (playmosFeeSink && !sameAddr(playmosFeeSink, locked)) {
|
|
867
|
+
throw new ConfigError("feeSink must equal the Playmos Sepolia treasury; refused before broadcast");
|
|
868
|
+
}
|
|
869
|
+
const sink = locked;
|
|
865
870
|
const forbidden = [sink, ...playmosAddresses.map((a) => a.toLowerCase())];
|
|
866
871
|
if (forbidden.some((a) => sameAddr(a, studio))) {
|
|
867
872
|
throw new ConfigError("studioWallet must not be a Playmos address (Playmos never holds studio keys)");
|
|
868
873
|
}
|
|
869
874
|
if (input.feeSink && !sameAddr(input.feeSink, sink)) {
|
|
870
|
-
throw new ConfigError("feeSink must equal the Playmos
|
|
875
|
+
throw new ConfigError("feeSink must equal the Playmos Sepolia treasury; refused before broadcast");
|
|
871
876
|
}
|
|
872
877
|
if (input.admin && !sameAddr(input.admin, studio)) {
|
|
873
878
|
throw new ConfigError("admin must be the studio wallet from block one");
|
|
@@ -898,6 +903,7 @@ function prepareStudioPoolLocal(input, playmosFeeSink, token, playmosAddresses =
|
|
|
898
903
|
feeSink: sink,
|
|
899
904
|
refundTimeout
|
|
900
905
|
}),
|
|
906
|
+
broadcast: false,
|
|
901
907
|
constructor: "EpochPrizePool",
|
|
902
908
|
studioHoldsAdmin: true,
|
|
903
909
|
studioHoldsOperator: true,
|
|
@@ -1102,8 +1108,11 @@ function createEpochsApi(deps) {
|
|
|
1102
1108
|
async preparePool(input) {
|
|
1103
1109
|
const studioWallet = requireAddr(input?.studioWallet, "studioWallet");
|
|
1104
1110
|
const cfg = deps.config();
|
|
1105
|
-
const sink =
|
|
1111
|
+
const sink = PLAYMOS_FEE_SINK_DEFAULT;
|
|
1106
1112
|
const token = (input.token ?? cfg.contracts?.usdc ?? "0x036cbd53842c5426634e7929541ec2318f3dcf7e").toLowerCase();
|
|
1113
|
+
if (input.playmosFeeSink && !sameAddr(input.playmosFeeSink, sink)) {
|
|
1114
|
+
throw new ConfigError("feeSink must equal the Playmos Sepolia treasury; refused before broadcast");
|
|
1115
|
+
}
|
|
1107
1116
|
if (cfg.mock) {
|
|
1108
1117
|
return prepareStudioPoolLocal({ ...input, studioWallet }, sink, token);
|
|
1109
1118
|
}
|
|
@@ -1809,7 +1818,7 @@ var Playmos = class {
|
|
|
1809
1818
|
},
|
|
1810
1819
|
walletAddress: async () => getAccount(this.walletProvider()),
|
|
1811
1820
|
readView: async (to, data) => {
|
|
1812
|
-
if (await walletAvailable(this.config.wallet, this.walletTimeoutPolicy())) {
|
|
1821
|
+
if (!await this.shouldServerSettle() && await walletAvailable(this.config.wallet, this.walletTimeoutPolicy())) {
|
|
1813
1822
|
const provider = this.walletProvider();
|
|
1814
1823
|
return await provider.request({
|
|
1815
1824
|
method: "eth_call",
|
|
@@ -2910,8 +2919,14 @@ var Playmos = class {
|
|
|
2910
2919
|
);
|
|
2911
2920
|
}
|
|
2912
2921
|
}
|
|
2922
|
+
if (config.settle === "server" && !this.env.isTest) {
|
|
2923
|
+
throw new ConfigError(
|
|
2924
|
+
'settle: "server" is sandbox-only. Live keys must use a player wallet \u2014 never server-settle real money.',
|
|
2925
|
+
{ field: "settle" }
|
|
2926
|
+
);
|
|
2927
|
+
}
|
|
2913
2928
|
this.http = createHttpClient(this.env.apiBaseUrl, config.apiKey, config.retry);
|
|
2914
|
-
if (!config.mock) {
|
|
2929
|
+
if (!config.mock && config.settle !== "server") {
|
|
2915
2930
|
try {
|
|
2916
2931
|
resolveProvider(config.wallet, this.walletTimeoutPolicy());
|
|
2917
2932
|
} catch {
|
|
@@ -2981,6 +2996,23 @@ var Playmos = class {
|
|
|
2981
2996
|
return 0n;
|
|
2982
2997
|
}
|
|
2983
2998
|
}
|
|
2999
|
+
/**
|
|
3000
|
+
* Sandbox server-settle when the developer asked (`settle: "server"`) or when
|
|
3001
|
+
* a test key has no wallet. Never calls walletAvailable if the ask is set —
|
|
3002
|
+
* that is the MetaMask-hijack delete (Moonhop leftover Slice 1).
|
|
3003
|
+
*/
|
|
3004
|
+
async shouldServerSettle() {
|
|
3005
|
+
if (this.config.settle === "server") {
|
|
3006
|
+
if (!this.env.isTest) {
|
|
3007
|
+
throw new ConfigError(
|
|
3008
|
+
'settle: "server" is sandbox-only. Live keys must use a player wallet \u2014 never server-settle real money.',
|
|
3009
|
+
{ field: "settle" }
|
|
3010
|
+
);
|
|
3011
|
+
}
|
|
3012
|
+
return true;
|
|
3013
|
+
}
|
|
3014
|
+
return this.env.isTest && !await walletAvailable(this.config.wallet, this.walletTimeoutPolicy());
|
|
3015
|
+
}
|
|
2984
3016
|
/**
|
|
2985
3017
|
* Wallet timeout policy (#462 / PR #463 residual).
|
|
2986
3018
|
* - connectTimeoutMs → eth_requestAccounts only
|
|
@@ -3108,7 +3140,7 @@ var Playmos = class {
|
|
|
3108
3140
|
heldIdem ? { key: heldIdem, terms } : void 0
|
|
3109
3141
|
);
|
|
3110
3142
|
}
|
|
3111
|
-
if (
|
|
3143
|
+
if (await this.shouldServerSettle()) {
|
|
3112
3144
|
const res = await this.http.post(
|
|
3113
3145
|
"/payments",
|
|
3114
3146
|
{
|
|
@@ -3213,7 +3245,7 @@ var Playmos = class {
|
|
|
3213
3245
|
heldIdem ? { key: heldIdem, terms } : void 0
|
|
3214
3246
|
);
|
|
3215
3247
|
}
|
|
3216
|
-
const serverSettleNoWallet =
|
|
3248
|
+
const serverSettleNoWallet = await this.shouldServerSettle();
|
|
3217
3249
|
if (!serverSettleNoWallet) {
|
|
3218
3250
|
const pinned = typeof input.identity === "string" ? input.identity.trim() : "";
|
|
3219
3251
|
if (!pinned) {
|
|
@@ -3543,7 +3575,7 @@ var Playmos = class {
|
|
|
3543
3575
|
});
|
|
3544
3576
|
let raw;
|
|
3545
3577
|
try {
|
|
3546
|
-
if (await walletAvailable(this.config.wallet, this.walletTimeoutPolicy())) {
|
|
3578
|
+
if (!await this.shouldServerSettle() && await walletAvailable(this.config.wallet, this.walletTimeoutPolicy())) {
|
|
3547
3579
|
const provider = this.walletProvider();
|
|
3548
3580
|
raw = await provider.request({
|
|
3549
3581
|
method: "eth_call",
|
|
@@ -3755,4 +3787,4 @@ function isX402PayloadAuthorization(auth) {
|
|
|
3755
3787
|
return auth.kind === "x402-payload";
|
|
3756
3788
|
}
|
|
3757
3789
|
|
|
3758
|
-
export { C1_ENTER_SPLIT_MICRO, CHAIN_ID, DEFAULT_API_BASE_URL, MICRO_PER_USDC, PLAYMOS_FEE_SINK_DEFAULT, PayoutError, Playmos, USDC_ADDRESS, USDC_DECIMALS, buildEpochClaimRefundCall, buildEpochEntryCalls, buildEpochWithdrawCall, clientRuntimeSignals, computeIapSplit, computePayout, computePoolSplit, createEpochsApi, createPaymentRequirement, createX402Challenge, decodePaymentHeader, derivedEpochId, encodeEpochPoolConstructorArgs, encodePaymentHeader, epochPayableMicro, epochPoolProofMessage, formatMicroToUsd, isClientRuntime, isWalletSignatureAuthorization, isX402PayloadAuthorization, networkToCaip2, parsePaymentRequirement, parseUsdToMicro, prefixedId, prepareStudioPoolLocal, previewEscrowFee, previewIapSplit, previewMarketplaceSplit, previewPoolSplit, previewTransferSplit, resolveEnv, serializePaymentRequirement, settlementTypedData, toX402PaymentRequired, ulid, validateX402ChallengeInput };
|
|
3790
|
+
export { C1_ENTER_SPLIT_MICRO, CHAIN_ID, DEFAULT_API_BASE_URL, MICRO_PER_USDC, PLAYMOS_FEE_SINK_DEFAULT, PayoutError, Playmos, RETIRED_PLAYMOS_FEE_SINK, USDC_ADDRESS, USDC_DECIMALS, buildEpochClaimRefundCall, buildEpochEntryCalls, buildEpochWithdrawCall, clientRuntimeSignals, computeIapSplit, computePayout, computePoolSplit, createEpochsApi, createPaymentRequirement, createX402Challenge, decodePaymentHeader, derivedEpochId, encodeEpochPoolConstructorArgs, encodePaymentHeader, epochPayableMicro, epochPoolProofMessage, formatMicroToUsd, isClientRuntime, isWalletSignatureAuthorization, isX402PayloadAuthorization, networkToCaip2, parsePaymentRequirement, parseUsdToMicro, prefixedId, prepareStudioPoolLocal, previewEscrowFee, previewIapSplit, previewMarketplaceSplit, previewPoolSplit, previewTransferSplit, resolveEnv, serializePaymentRequirement, settlementTypedData, toX402PaymentRequired, ulid, validateX402ChallengeInput };
|
package/dist/server.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a2 as PlaymosError, W as WebhookEvent } from './errors-
|
|
2
|
-
export { ad as enterPathToBytes32 } from './errors-
|
|
1
|
+
import { a2 as PlaymosError, W as WebhookEvent } from './errors-WcDNfb4q.cjs';
|
|
2
|
+
export { ad as enterPathToBytes32 } from './errors-WcDNfb4q.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Webhook signature verification (spec §6.2) — server-side only.
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a2 as PlaymosError, W as WebhookEvent } from './errors-
|
|
2
|
-
export { ad as enterPathToBytes32 } from './errors-
|
|
1
|
+
import { a2 as PlaymosError, W as WebhookEvent } from './errors-WcDNfb4q.js';
|
|
2
|
+
export { ad as enterPathToBytes32 } from './errors-WcDNfb4q.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Webhook signature verification (spec §6.2) — server-side only.
|
package/dist/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PlaymosError, ApiError, toBytes32 } from './chunk-
|
|
2
|
-
export { toBytes32 as enterPathToBytes32 } from './chunk-
|
|
1
|
+
import { PlaymosError, ApiError, toBytes32 } from './chunk-TZFGZNXV.js';
|
|
2
|
+
export { toBytes32 as enterPathToBytes32 } from './chunk-TZFGZNXV.js';
|
|
3
3
|
import { timingSafeEqual, createHmac } from 'crypto';
|
|
4
4
|
import { encodeFunctionData, decodeFunctionResult } from 'viem';
|
|
5
5
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playmos/sdk",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "Playmos SDK — stablecoin payments for games on Base.
|
|
5
|
-
"license": "
|
|
3
|
+
"version": "0.3.14",
|
|
4
|
+
"description": "Playmos SDK — stablecoin payments for games on Base. IAP and skill contests are flat 1%. USD in, USDC on-chain, no crypto UX for players.",
|
|
5
|
+
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
7
7
|
"homepage": "https://playmos-docs-public.vercel.app/",
|
|
8
8
|
"bugs": {
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"!dist/**/*.map",
|
|
35
35
|
"README.md",
|
|
36
36
|
"CHANGELOG.md",
|
|
37
|
+
"LICENSE",
|
|
37
38
|
"package.json"
|
|
38
39
|
],
|
|
39
40
|
"scripts": {
|
|
File without changes
|