@playmos/sdk 0.3.2 → 0.3.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/README.md +15 -0
- package/dist/{chunk-TMBBEGIF.js → chunk-VYR6BBHF.js} +0 -2
- package/dist/{errors-DMtMpbR6.d.cts → errors-B_AqyZQE.d.cts} +42 -12
- package/dist/{errors-DMtMpbR6.d.ts → errors-B_AqyZQE.d.ts} +42 -12
- package/dist/index.cjs +409 -110
- package/dist/index.d.cts +64 -17
- package/dist/index.d.ts +64 -17
- package/dist/index.js +409 -113
- package/dist/server.cjs +0 -2
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -3
- package/package.json +10 -5
- package/dist/chunk-TMBBEGIF.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/server.cjs.map +0 -1
- package/dist/server.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as Network, P as PlaymosConfig, W as WebhookEvent, R as RoundOpenInput, a as RoundState, b as RoundSettleInput, S as SettleRoundResult, c as PrizeBalance, d as WithdrawResult, A as AgentWallet, e as AgentFundResult, T as TransferResult, E as EscrowHoldInput, f as EscrowHoldResult, g as EscrowResolveResult, M as MarketplaceListInput, L as Listing, h as MarketplaceSaleResult, i as MarketplaceGetResult, j as PayInput, k as Payment, l as EnterRoundInput, m as TransferReconcile, n as WaitOptions, o as TransferInput, p as TransferConfirmOptions, V as VerifyResult } from './errors-
|
|
2
|
-
export {
|
|
1
|
+
import { N as Network, P as PlaymosConfig, W as WebhookEvent, R as RoundOpenInput, a as RoundState, b as RoundSettleInput, S as SettleRoundResult, C as CancelRoundResult, c as PrizeBalance, d as WithdrawResult, A as AgentWallet, e as AgentFundResult, T as TransferResult, E as EscrowHoldInput, f as EscrowHoldResult, g as EscrowResolveResult, M as MarketplaceListInput, L as Listing, h as MarketplaceSaleResult, i as MarketplaceGetResult, j as PayInput, k as Payment, l as EnterRoundInput, m as TransferReconcile, n as WaitOptions, o as TransferInput, p as TransferConfirmOptions, V as VerifyResult, q as PayoutRule } from './errors-B_AqyZQE.cjs';
|
|
2
|
+
export { r as AgentEconomyConfig, s as ApiError, t as AuthError, u as ConfigError, v as ContractConfig, w as Eip1193Provider, G as GasConfig, x as GasMode, I as InsufficientGasError, y as InvalidAmountError, z as ListingStatus, B as MarketplaceItem, D as MarketplaceSale, F as MissingFieldError, H as NothingToWithdrawError, J as PaymentFailedError, K as PaymentStatus, O as PlaymosError, Q as PlaymosErrorCode, U as RetryOptions, X as RoundStatus, Y as WalletConfig, Z as WalletConnectionError, _ as WalletConnector, $ as WebhookEventType } from './errors-B_AqyZQE.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Environment resolution + the canonical address book.
|
|
@@ -21,7 +21,30 @@ interface ResolvedEnv {
|
|
|
21
21
|
chainId: number;
|
|
22
22
|
apiBaseUrl: string;
|
|
23
23
|
isTest: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* True for `sk_test_` / `sk_live_` — server-only secret keys.
|
|
26
|
+
* False for `pk_test_` / `pk_live_` — browser-safe publishable keys.
|
|
27
|
+
* Capability must track this in code (not only docs): secret surfaces refuse pk_.
|
|
28
|
+
*/
|
|
29
|
+
isSecret: boolean;
|
|
24
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Signals that indicate a **client/device** JS realm (not Node/SSR server).
|
|
33
|
+
*
|
|
34
|
+
* #260: `window`. #263: `document`, `importScripts` (Worker), ReactNative.
|
|
35
|
+
* #271: Cloudflare Workers historically stub `importScripts` on older
|
|
36
|
+
* compatibility dates — do **not** treat importScripts alone as client when a
|
|
37
|
+
* CF Worker marker is present (edge is not a claimed target; this avoids
|
|
38
|
+
* false-positive AuthError for sk_ in Workers backends).
|
|
39
|
+
*
|
|
40
|
+
* Limit: Electron main / Node CLIs with a baked sk_ still look like servers
|
|
41
|
+
* (no client signals) — runtime sniffing cannot close that class.
|
|
42
|
+
*/
|
|
43
|
+
declare function clientRuntimeSignals(g?: typeof globalThis): string[];
|
|
44
|
+
/** True when this JS realm is a **client/device** runtime (not Node/SSR server). */
|
|
45
|
+
declare function isClientRuntime(g?: typeof globalThis): boolean;
|
|
46
|
+
/** Validate the key and resolve the environment it implies. */
|
|
47
|
+
declare function resolveEnv(apiKey: string, networkOverride?: Network, apiBaseUrlOverride?: string): ResolvedEnv;
|
|
25
48
|
|
|
26
49
|
/**
|
|
27
50
|
* settlement.ts — the x402-ready settlement CORE contract (Phase 0).
|
|
@@ -379,11 +402,11 @@ declare class Playmos {
|
|
|
379
402
|
verify: (_rawBody: string | Buffer, _signatureHeader: string | string[] | undefined, _secret: string) => WebhookEvent;
|
|
380
403
|
};
|
|
381
404
|
readonly payouts: {
|
|
382
|
-
/** Choose how the studio is paid: "usdc" (default) or "fiat" (Bridge). */
|
|
405
|
+
/** Choose how the studio is paid: "usdc" (default) or "fiat" (Bridge). Secret key only (#264). */
|
|
383
406
|
setMode: (mode: "usdc" | "fiat") => Promise<{
|
|
384
407
|
mode: "usdc" | "fiat";
|
|
385
408
|
}>;
|
|
386
|
-
/** Create a Bridge KYC onboarding link (fiat payout). */
|
|
409
|
+
/** Create a Bridge KYC onboarding link (fiat payout). Secret key only (#264). */
|
|
387
410
|
createOnboardingLink: () => Promise<{
|
|
388
411
|
url: string;
|
|
389
412
|
}>;
|
|
@@ -420,6 +443,10 @@ declare class Playmos {
|
|
|
420
443
|
* Settle a previously minted challenge with an `x402-payload` authorization.
|
|
421
444
|
* Defaults mode to `server-signer` when omitted (explicit on the wire — fail-closed
|
|
422
445
|
* materialize still requires mode; the route also defaults for this path).
|
|
446
|
+
*
|
|
447
|
+
* #259/#269: settle uses `idempotency-key = requirement.id` and auto-retries gateway 504.
|
|
448
|
+
* A 504 replay may return **without throwing** with `success: false`, `status: "settling"`,
|
|
449
|
+
* `txHash: null` (in-flight). Treat as non-final — re-call or verify later; do not new-key.
|
|
423
450
|
*/
|
|
424
451
|
fulfill: (requirement: PaymentRequirement, authorization?: X402FulfillAuthorization | X402PayloadAuthorization) => Promise<X402SettleResult>;
|
|
425
452
|
/**
|
|
@@ -437,6 +464,10 @@ declare class Playmos {
|
|
|
437
464
|
*
|
|
438
465
|
* Operator txs are signed by the Playmos service (OPERATOR_ROLE key).
|
|
439
466
|
*/
|
|
467
|
+
/** Offline mock store for rounds.open/lock/settle/get when `mock: true` (3-game dogfood). */
|
|
468
|
+
private readonly mockRounds;
|
|
469
|
+
/** Mock withdrawable credits after settle — key `${roundId}:${walletLower}` (#240 offline prize). */
|
|
470
|
+
private readonly mockWithdrawable;
|
|
440
471
|
readonly rounds: {
|
|
441
472
|
open: (input: RoundOpenInput) => Promise<RoundState>;
|
|
442
473
|
lock: (input: {
|
|
@@ -444,6 +475,15 @@ declare class Playmos {
|
|
|
444
475
|
gameId?: string;
|
|
445
476
|
}) => Promise<RoundState>;
|
|
446
477
|
settle: (input: RoundSettleInput) => Promise<SettleRoundResult>;
|
|
478
|
+
/**
|
|
479
|
+
* Cancel an open/locked round (operator sk_ only). Refunds entrants' escrowed ~90%
|
|
480
|
+
* and frees the series latch. May return `status: "cancelling"` (HTTP 202) until
|
|
481
|
+
* chain Cancelled(4) reconciles — poll `rounds.get` or re-call cancel (#346).
|
|
482
|
+
*/
|
|
483
|
+
cancel: (input: {
|
|
484
|
+
roundId: string;
|
|
485
|
+
gameId?: string;
|
|
486
|
+
}) => Promise<CancelRoundResult>;
|
|
447
487
|
get: (input: {
|
|
448
488
|
roundId: string;
|
|
449
489
|
}) => Promise<RoundState>;
|
|
@@ -579,7 +619,8 @@ declare class Playmos {
|
|
|
579
619
|
entryUnits: bigint;
|
|
580
620
|
}): Promise<{
|
|
581
621
|
paymentId: string;
|
|
582
|
-
status
|
|
622
|
+
/** Lowercase product status (matches Payment.status) — 0.3.3+; kits should compare case-insensitively. */
|
|
623
|
+
status: "confirmed" | "failed" | "pending";
|
|
583
624
|
txHash?: string;
|
|
584
625
|
onchain: boolean;
|
|
585
626
|
/** The on-chain identity actually entered — reconcile with `hasEntered`. */
|
|
@@ -632,10 +673,24 @@ declare class Playmos {
|
|
|
632
673
|
/** Verify a payment by the service's on-chain read (spec §6.1). Idempotent. */
|
|
633
674
|
verify(paymentId: string): Promise<VerifyResult>;
|
|
634
675
|
/**
|
|
635
|
-
*
|
|
636
|
-
*
|
|
676
|
+
* Secret (sk_) surfaces — agents / transfer / x402. Capability tracks key type
|
|
677
|
+
* in code, not README prose (#260). pk_ keys are client-safe and refuse these.
|
|
678
|
+
*/
|
|
679
|
+
private assertSecretKey;
|
|
680
|
+
/**
|
|
681
|
+
* x402 V1 is Base Sepolia + secret test keys only (ADR D5 + #260). Fail closed
|
|
682
|
+
* before any network call so mainnet / live / publishable keys never hit the adapter.
|
|
683
|
+
* Does not change fulfill/settle body shape (A owns #261 / #259 money path).
|
|
637
684
|
*/
|
|
638
685
|
private assertX402Allowed;
|
|
686
|
+
/**
|
|
687
|
+
* Poll GET /payments/:id after server-settle until terminal status.
|
|
688
|
+
* - Entry (#221): service may return 202 pending (openRound+enter > DO edge).
|
|
689
|
+
* - IAP: service often returns 201 + txHash while status is still "created"
|
|
690
|
+
* until chain verify catches PaymentSettled (RPC lag) — poll so pay() matches
|
|
691
|
+
* the documented "confirmed" sandbox promise (TTFSC-T0 / cold-run).
|
|
692
|
+
*/
|
|
693
|
+
private waitForServerSettle;
|
|
639
694
|
/**
|
|
640
695
|
* Map a server-settled payment (from the `settle: "server"` response) into the
|
|
641
696
|
* SDK's `Payment` shape. The service already signed + confirmed on-chain, so we
|
|
@@ -713,15 +768,7 @@ declare function previewPoolSplit(amount: string): {
|
|
|
713
768
|
*
|
|
714
769
|
* No network, no chain — fully unit-testable.
|
|
715
770
|
*/
|
|
716
|
-
|
|
717
|
-
kind: "winner-take-all";
|
|
718
|
-
} | {
|
|
719
|
-
kind: "top-n";
|
|
720
|
-
splitsBps: number[];
|
|
721
|
-
} | {
|
|
722
|
-
kind: "custom";
|
|
723
|
-
amounts: string[];
|
|
724
|
-
};
|
|
771
|
+
|
|
725
772
|
declare class PayoutError extends Error {
|
|
726
773
|
code: "payout_invalid";
|
|
727
774
|
constructor(message: string);
|
|
@@ -793,4 +840,4 @@ declare function ulid(seedTime?: number): string;
|
|
|
793
840
|
/** `${prefix}_${ulid()}` — e.g. `pay_01J…`, `entry_01J…`, `idem_01J…`. */
|
|
794
841
|
declare function prefixedId(prefix: string): string;
|
|
795
842
|
|
|
796
|
-
export { AgentFundResult, AgentWallet, type Authorization, CHAIN_ID, type CreatePaymentRequirementInput, DEFAULT_API_BASE_URL, EnterRoundInput, EscrowHoldInput, EscrowHoldResult, EscrowResolveResult, Listing, MICRO_PER_USDC, MarketplaceGetResult, MarketplaceListInput, MarketplaceSaleResult, Network, PayInput, Payment, type PaymentRequirement, PayoutError,
|
|
843
|
+
export { AgentFundResult, AgentWallet, type Authorization, CHAIN_ID, CancelRoundResult, type CreatePaymentRequirementInput, DEFAULT_API_BASE_URL, EnterRoundInput, EscrowHoldInput, EscrowHoldResult, EscrowResolveResult, Listing, MICRO_PER_USDC, MarketplaceGetResult, MarketplaceListInput, MarketplaceSaleResult, Network, PayInput, Payment, type PaymentRequirement, PayoutError, PayoutRule, PayoutRule as PayoutRuleCompute, Playmos, PlaymosConfig, PrizeBalance, RoundOpenInput, RoundSettleInput, RoundState, SettleRoundResult, type SettlementAsset, 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, clientRuntimeSignals, computeIapSplit, computePayout, computePoolSplit, createPaymentRequirement, createX402Challenge, decodePaymentHeader, encodePaymentHeader, formatMicroToUsd, isClientRuntime, isWalletSignatureAuthorization, isX402PayloadAuthorization, networkToCaip2, parsePaymentRequirement, parseUsdToMicro, prefixedId, previewEscrowFee, previewIapSplit, previewMarketplaceSplit, previewPoolSplit, previewTransferSplit, resolveEnv, serializePaymentRequirement, toX402PaymentRequired, ulid, validateX402ChallengeInput };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as Network, P as PlaymosConfig, W as WebhookEvent, R as RoundOpenInput, a as RoundState, b as RoundSettleInput, S as SettleRoundResult, c as PrizeBalance, d as WithdrawResult, A as AgentWallet, e as AgentFundResult, T as TransferResult, E as EscrowHoldInput, f as EscrowHoldResult, g as EscrowResolveResult, M as MarketplaceListInput, L as Listing, h as MarketplaceSaleResult, i as MarketplaceGetResult, j as PayInput, k as Payment, l as EnterRoundInput, m as TransferReconcile, n as WaitOptions, o as TransferInput, p as TransferConfirmOptions, V as VerifyResult } from './errors-
|
|
2
|
-
export {
|
|
1
|
+
import { N as Network, P as PlaymosConfig, W as WebhookEvent, R as RoundOpenInput, a as RoundState, b as RoundSettleInput, S as SettleRoundResult, C as CancelRoundResult, c as PrizeBalance, d as WithdrawResult, A as AgentWallet, e as AgentFundResult, T as TransferResult, E as EscrowHoldInput, f as EscrowHoldResult, g as EscrowResolveResult, M as MarketplaceListInput, L as Listing, h as MarketplaceSaleResult, i as MarketplaceGetResult, j as PayInput, k as Payment, l as EnterRoundInput, m as TransferReconcile, n as WaitOptions, o as TransferInput, p as TransferConfirmOptions, V as VerifyResult, q as PayoutRule } from './errors-B_AqyZQE.js';
|
|
2
|
+
export { r as AgentEconomyConfig, s as ApiError, t as AuthError, u as ConfigError, v as ContractConfig, w as Eip1193Provider, G as GasConfig, x as GasMode, I as InsufficientGasError, y as InvalidAmountError, z as ListingStatus, B as MarketplaceItem, D as MarketplaceSale, F as MissingFieldError, H as NothingToWithdrawError, J as PaymentFailedError, K as PaymentStatus, O as PlaymosError, Q as PlaymosErrorCode, U as RetryOptions, X as RoundStatus, Y as WalletConfig, Z as WalletConnectionError, _ as WalletConnector, $ as WebhookEventType } from './errors-B_AqyZQE.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Environment resolution + the canonical address book.
|
|
@@ -21,7 +21,30 @@ interface ResolvedEnv {
|
|
|
21
21
|
chainId: number;
|
|
22
22
|
apiBaseUrl: string;
|
|
23
23
|
isTest: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* True for `sk_test_` / `sk_live_` — server-only secret keys.
|
|
26
|
+
* False for `pk_test_` / `pk_live_` — browser-safe publishable keys.
|
|
27
|
+
* Capability must track this in code (not only docs): secret surfaces refuse pk_.
|
|
28
|
+
*/
|
|
29
|
+
isSecret: boolean;
|
|
24
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Signals that indicate a **client/device** JS realm (not Node/SSR server).
|
|
33
|
+
*
|
|
34
|
+
* #260: `window`. #263: `document`, `importScripts` (Worker), ReactNative.
|
|
35
|
+
* #271: Cloudflare Workers historically stub `importScripts` on older
|
|
36
|
+
* compatibility dates — do **not** treat importScripts alone as client when a
|
|
37
|
+
* CF Worker marker is present (edge is not a claimed target; this avoids
|
|
38
|
+
* false-positive AuthError for sk_ in Workers backends).
|
|
39
|
+
*
|
|
40
|
+
* Limit: Electron main / Node CLIs with a baked sk_ still look like servers
|
|
41
|
+
* (no client signals) — runtime sniffing cannot close that class.
|
|
42
|
+
*/
|
|
43
|
+
declare function clientRuntimeSignals(g?: typeof globalThis): string[];
|
|
44
|
+
/** True when this JS realm is a **client/device** runtime (not Node/SSR server). */
|
|
45
|
+
declare function isClientRuntime(g?: typeof globalThis): boolean;
|
|
46
|
+
/** Validate the key and resolve the environment it implies. */
|
|
47
|
+
declare function resolveEnv(apiKey: string, networkOverride?: Network, apiBaseUrlOverride?: string): ResolvedEnv;
|
|
25
48
|
|
|
26
49
|
/**
|
|
27
50
|
* settlement.ts — the x402-ready settlement CORE contract (Phase 0).
|
|
@@ -379,11 +402,11 @@ declare class Playmos {
|
|
|
379
402
|
verify: (_rawBody: string | Buffer, _signatureHeader: string | string[] | undefined, _secret: string) => WebhookEvent;
|
|
380
403
|
};
|
|
381
404
|
readonly payouts: {
|
|
382
|
-
/** Choose how the studio is paid: "usdc" (default) or "fiat" (Bridge). */
|
|
405
|
+
/** Choose how the studio is paid: "usdc" (default) or "fiat" (Bridge). Secret key only (#264). */
|
|
383
406
|
setMode: (mode: "usdc" | "fiat") => Promise<{
|
|
384
407
|
mode: "usdc" | "fiat";
|
|
385
408
|
}>;
|
|
386
|
-
/** Create a Bridge KYC onboarding link (fiat payout). */
|
|
409
|
+
/** Create a Bridge KYC onboarding link (fiat payout). Secret key only (#264). */
|
|
387
410
|
createOnboardingLink: () => Promise<{
|
|
388
411
|
url: string;
|
|
389
412
|
}>;
|
|
@@ -420,6 +443,10 @@ declare class Playmos {
|
|
|
420
443
|
* Settle a previously minted challenge with an `x402-payload` authorization.
|
|
421
444
|
* Defaults mode to `server-signer` when omitted (explicit on the wire — fail-closed
|
|
422
445
|
* materialize still requires mode; the route also defaults for this path).
|
|
446
|
+
*
|
|
447
|
+
* #259/#269: settle uses `idempotency-key = requirement.id` and auto-retries gateway 504.
|
|
448
|
+
* A 504 replay may return **without throwing** with `success: false`, `status: "settling"`,
|
|
449
|
+
* `txHash: null` (in-flight). Treat as non-final — re-call or verify later; do not new-key.
|
|
423
450
|
*/
|
|
424
451
|
fulfill: (requirement: PaymentRequirement, authorization?: X402FulfillAuthorization | X402PayloadAuthorization) => Promise<X402SettleResult>;
|
|
425
452
|
/**
|
|
@@ -437,6 +464,10 @@ declare class Playmos {
|
|
|
437
464
|
*
|
|
438
465
|
* Operator txs are signed by the Playmos service (OPERATOR_ROLE key).
|
|
439
466
|
*/
|
|
467
|
+
/** Offline mock store for rounds.open/lock/settle/get when `mock: true` (3-game dogfood). */
|
|
468
|
+
private readonly mockRounds;
|
|
469
|
+
/** Mock withdrawable credits after settle — key `${roundId}:${walletLower}` (#240 offline prize). */
|
|
470
|
+
private readonly mockWithdrawable;
|
|
440
471
|
readonly rounds: {
|
|
441
472
|
open: (input: RoundOpenInput) => Promise<RoundState>;
|
|
442
473
|
lock: (input: {
|
|
@@ -444,6 +475,15 @@ declare class Playmos {
|
|
|
444
475
|
gameId?: string;
|
|
445
476
|
}) => Promise<RoundState>;
|
|
446
477
|
settle: (input: RoundSettleInput) => Promise<SettleRoundResult>;
|
|
478
|
+
/**
|
|
479
|
+
* Cancel an open/locked round (operator sk_ only). Refunds entrants' escrowed ~90%
|
|
480
|
+
* and frees the series latch. May return `status: "cancelling"` (HTTP 202) until
|
|
481
|
+
* chain Cancelled(4) reconciles — poll `rounds.get` or re-call cancel (#346).
|
|
482
|
+
*/
|
|
483
|
+
cancel: (input: {
|
|
484
|
+
roundId: string;
|
|
485
|
+
gameId?: string;
|
|
486
|
+
}) => Promise<CancelRoundResult>;
|
|
447
487
|
get: (input: {
|
|
448
488
|
roundId: string;
|
|
449
489
|
}) => Promise<RoundState>;
|
|
@@ -579,7 +619,8 @@ declare class Playmos {
|
|
|
579
619
|
entryUnits: bigint;
|
|
580
620
|
}): Promise<{
|
|
581
621
|
paymentId: string;
|
|
582
|
-
status
|
|
622
|
+
/** Lowercase product status (matches Payment.status) — 0.3.3+; kits should compare case-insensitively. */
|
|
623
|
+
status: "confirmed" | "failed" | "pending";
|
|
583
624
|
txHash?: string;
|
|
584
625
|
onchain: boolean;
|
|
585
626
|
/** The on-chain identity actually entered — reconcile with `hasEntered`. */
|
|
@@ -632,10 +673,24 @@ declare class Playmos {
|
|
|
632
673
|
/** Verify a payment by the service's on-chain read (spec §6.1). Idempotent. */
|
|
633
674
|
verify(paymentId: string): Promise<VerifyResult>;
|
|
634
675
|
/**
|
|
635
|
-
*
|
|
636
|
-
*
|
|
676
|
+
* Secret (sk_) surfaces — agents / transfer / x402. Capability tracks key type
|
|
677
|
+
* in code, not README prose (#260). pk_ keys are client-safe and refuse these.
|
|
678
|
+
*/
|
|
679
|
+
private assertSecretKey;
|
|
680
|
+
/**
|
|
681
|
+
* x402 V1 is Base Sepolia + secret test keys only (ADR D5 + #260). Fail closed
|
|
682
|
+
* before any network call so mainnet / live / publishable keys never hit the adapter.
|
|
683
|
+
* Does not change fulfill/settle body shape (A owns #261 / #259 money path).
|
|
637
684
|
*/
|
|
638
685
|
private assertX402Allowed;
|
|
686
|
+
/**
|
|
687
|
+
* Poll GET /payments/:id after server-settle until terminal status.
|
|
688
|
+
* - Entry (#221): service may return 202 pending (openRound+enter > DO edge).
|
|
689
|
+
* - IAP: service often returns 201 + txHash while status is still "created"
|
|
690
|
+
* until chain verify catches PaymentSettled (RPC lag) — poll so pay() matches
|
|
691
|
+
* the documented "confirmed" sandbox promise (TTFSC-T0 / cold-run).
|
|
692
|
+
*/
|
|
693
|
+
private waitForServerSettle;
|
|
639
694
|
/**
|
|
640
695
|
* Map a server-settled payment (from the `settle: "server"` response) into the
|
|
641
696
|
* SDK's `Payment` shape. The service already signed + confirmed on-chain, so we
|
|
@@ -713,15 +768,7 @@ declare function previewPoolSplit(amount: string): {
|
|
|
713
768
|
*
|
|
714
769
|
* No network, no chain — fully unit-testable.
|
|
715
770
|
*/
|
|
716
|
-
|
|
717
|
-
kind: "winner-take-all";
|
|
718
|
-
} | {
|
|
719
|
-
kind: "top-n";
|
|
720
|
-
splitsBps: number[];
|
|
721
|
-
} | {
|
|
722
|
-
kind: "custom";
|
|
723
|
-
amounts: string[];
|
|
724
|
-
};
|
|
771
|
+
|
|
725
772
|
declare class PayoutError extends Error {
|
|
726
773
|
code: "payout_invalid";
|
|
727
774
|
constructor(message: string);
|
|
@@ -793,4 +840,4 @@ declare function ulid(seedTime?: number): string;
|
|
|
793
840
|
/** `${prefix}_${ulid()}` — e.g. `pay_01J…`, `entry_01J…`, `idem_01J…`. */
|
|
794
841
|
declare function prefixedId(prefix: string): string;
|
|
795
842
|
|
|
796
|
-
export { AgentFundResult, AgentWallet, type Authorization, CHAIN_ID, type CreatePaymentRequirementInput, DEFAULT_API_BASE_URL, EnterRoundInput, EscrowHoldInput, EscrowHoldResult, EscrowResolveResult, Listing, MICRO_PER_USDC, MarketplaceGetResult, MarketplaceListInput, MarketplaceSaleResult, Network, PayInput, Payment, type PaymentRequirement, PayoutError,
|
|
843
|
+
export { AgentFundResult, AgentWallet, type Authorization, CHAIN_ID, CancelRoundResult, type CreatePaymentRequirementInput, DEFAULT_API_BASE_URL, EnterRoundInput, EscrowHoldInput, EscrowHoldResult, EscrowResolveResult, Listing, MICRO_PER_USDC, MarketplaceGetResult, MarketplaceListInput, MarketplaceSaleResult, Network, PayInput, Payment, type PaymentRequirement, PayoutError, PayoutRule, PayoutRule as PayoutRuleCompute, Playmos, PlaymosConfig, PrizeBalance, RoundOpenInput, RoundSettleInput, RoundState, SettleRoundResult, type SettlementAsset, 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, clientRuntimeSignals, computeIapSplit, computePayout, computePoolSplit, createPaymentRequirement, createX402Challenge, decodePaymentHeader, encodePaymentHeader, formatMicroToUsd, isClientRuntime, isWalletSignatureAuthorization, isX402PayloadAuthorization, networkToCaip2, parsePaymentRequirement, parseUsdToMicro, prefixedId, previewEscrowFee, previewIapSplit, previewMarketplaceSplit, previewPoolSplit, previewTransferSplit, resolveEnv, serializePaymentRequirement, toX402PaymentRequired, ulid, validateX402ChallengeInput };
|